netsilik / struct
通过规则限制的魔法方法简化获取器和设置器。支持只读公共属性。
2.0.3
2019-08-17 10:01 UTC
Requires
- php: ^7.0
Requires (Dev)
- phpunit/phpunit: 5.4.*
README
通过规则限制的魔法方法简化获取器和设置器。支持只读公共属性。
MIT 许可证
除非适用法律要求或书面同意,否则在许可证下分发的软件按“原样”分发,不提供任何明示或暗示的保证或条件。
联系方式:info@netsilik.nl
最新版本可在:https://gitlab.com/Netsilik/Struct
用法
namespace Nestilik\Example; use Netsilik\Lib\Struct; /** * Foo class */ class Foo extends Struct { /** * @var array $_settableProperties The list of properties that are settable */ protected $_settableProperties = ['name', 'description']; /** * @var integer $objectId */ protected $objectId; /** * @var string $name */ protected $name; /** * @var string $description */ protected $description; } $myFoo = new Foo(); $myFoo->name = 'Test'; echo $myFoo->name; // Test
安装
composer require netsilik/struct