1
0
Fork 0
mirror of https://github.com/archtechx/livewire-access.git synced 2025-12-12 04:14:03 +00:00
livewire-access/src/WithExplicitAccess.php
Samuel Štancl e50e22434f initial
2021-03-17 17:28:17 +01:00

23 lines
691 B
PHP

<?php
declare(strict_types=1);
namespace Lean\LivewireAccess;
use ReflectionMethod;
use ReflectionProperty;
trait WithExplicitAccess
{
protected function methodIsPublicAndNotDefinedOnBaseClass($methodName)
{
return parent::methodIsPublicAndNotDefinedOnBaseClass($methodName)
&& count((new ReflectionMethod($this, $methodName))->getAttributes(FrontendAccess::class)) > 0;
}
public function propertyIsPublicAndNotDefinedOnBaseClass($propertyName)
{
return parent::propertyIsPublicAndNotDefinedOnBaseClass($propertyName)
&& count((new ReflectionProperty($this, $propertyName))->getAttributes(FrontendAccess::class)) > 0;
}
}