Files
hyperf_test/app/Service/Test/Composite/Permission/SimplePermission.php

51 lines
891 B
PHP

<?php
/**
* This service file is part of item.
*
* @author ctexthuang
* @contact ctexthuang@qq.com
* @web_site https://ctexthuang.com
*/
declare(strict_types=1);
namespace App\Service\Test\Composite\Permission;
use App\Interface\Test\Composite\PermissionComponentInterface;
/**
* 权限叶子节点
*/
class SimplePermission implements PermissionComponentInterface
{
/**
* @var string
*/
private string $name;
/**
* 构造函数
* @param string $name
*/
public function __construct(string $name)
{
$this->name = $name;
}
/**
* @param string $permission
* @return bool
*/
public function check(string $permission): bool
{
return $this->name === $permission;
}
/**
* @return string
*/
public function getName(): string
{
return $this->name;
}
}