diff options
Diffstat (limited to 'core/namespace/Attribute.php')
-rw-r--r-- | core/namespace/Attribute.php | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/core/namespace/Attribute.php b/core/namespace/Attribute.php index 69998e0..32cfa0a 100644 --- a/core/namespace/Attribute.php +++ b/core/namespace/Attribute.php @@ -16,6 +16,17 @@ abstract class Attribute implements AttributeInterface { } #=============================================================================== + # Get all attributes + #=============================================================================== + public function getAll($exclude = []): array { + $attributes = get_object_vars($this); + + return array_filter($attributes, function($attribute) use($exclude) { + return !in_array($attribute, $exclude); + }, ARRAY_FILTER_USE_KEY); + } + + #=============================================================================== # Get array with not FALSE attributes #=============================================================================== protected function getFilteredAttributes(): array { |