v2.0.0b
This commit is contained in:
parent
c92baf6cda
commit
dd680c8a9a
|
@ -69,10 +69,10 @@ abstract class Reflected
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $list;
|
return array_reverse($list);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->attributes;
|
return array_reverse($this->attributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAttribute(string|array $attributeType): ?object
|
public function getAttribute(string|array $attributeType): ?object
|
||||||
|
|
|
@ -39,12 +39,17 @@ class ReflectedClass implements ReflectedInterface
|
||||||
) : $this->methods;
|
) : $this->methods;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAttributes(bool $deep = true, ?string $attributeType = null) : array
|
public function getAttributes(bool $deep = true, ? string $attributeType = null) : array
|
||||||
|
{
|
||||||
|
return array_reverse($this->getOrderedAttributes($deep, $attributeType));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getOrderedAttributes(bool $deep = true, ? string $attributeType = null) : array
|
||||||
{
|
{
|
||||||
$attributes = $deep ? array_merge(
|
$attributes = $deep ? array_merge(
|
||||||
$this->parent ? $this->parent->getAttributes(true) : [],
|
$this->parent ? $this->parent->getOrderedAttributes(true) : [],
|
||||||
array_merge(...array_map(fn($e) => $e->getAttributes(true), $this->interfaces)),
|
array_merge(...array_map(fn($e) => $e->getOrderedAttributes(true), $this->interfaces)),
|
||||||
array_merge(...array_map(fn($e) => $e->getAttributes(true), $this->traits)),
|
array_merge(...array_map(fn($e) => $e->getOrderedAttributes(true), $this->traits)),
|
||||||
$this->attributes
|
$this->attributes
|
||||||
) : $this->attributes;
|
) : $this->attributes;
|
||||||
|
|
||||||
|
@ -167,7 +172,7 @@ class ReflectedClass implements ReflectedInterface
|
||||||
|
|
||||||
public function getAttribute(string $attributeType): ?object
|
public function getAttribute(string $attributeType): ?object
|
||||||
{
|
{
|
||||||
foreach($this->getAttributes($attributeType) as $attribute) {
|
foreach($this->getAttributes(true, $attributeType) as $attribute) {
|
||||||
if ($attribute->object instanceof $attributeType) {
|
if ($attribute->object instanceof $attributeType) {
|
||||||
return $attribute;
|
return $attribute;
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,7 @@ class RouteFetcher {
|
||||||
|
|
||||||
$objects = $objectResolver->reflectedClass->getClassAttributeListFromClassname($attributes['object'], true, false);
|
$objects = $objectResolver->reflectedClass->getClassAttributeListFromClassname($attributes['object'], true, false);
|
||||||
|
|
||||||
foreach(array_reverse($objects) as $object) {
|
foreach($objects as $object) {
|
||||||
if ($object->method ?? false ) {
|
if ($object->method ?? false ) {
|
||||||
$methods ??= (array) $object->method;
|
$methods ??= (array) $object->method;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ class SecurityHandler {
|
||||||
{
|
{
|
||||||
# Searching method first and fallbacking on object if none found
|
# Searching method first and fallbacking on object if none found
|
||||||
if ( $list = $this->findAttributes(Attribute\Security::class, $className, $methodName) ) {
|
if ( $list = $this->findAttributes(Attribute\Security::class, $className, $methodName) ) {
|
||||||
return array_pop($list)->locked;
|
return array_shift($list)->locked;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue