承接 aedart/athenaeum-properties 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

aedart/athenaeum-properties

最新稳定版本:9.20.0

Composer 安装命令:

composer require aedart/athenaeum-properties

包简介

Provides means to dynamically deal with inaccessible properties, by implementing some of PHP's magic methods

README 文档

README

Provides means to dynamically deal with inaccessible properties, by implementing some of PHP's magic methods.

The usage of getters- and setters-methods is enforced, ensuring that if a property is indeed available, its corresponding getter or setter method will be invoked.

The term 'overload', in this context, refers to PHP’s own definition hereof.

Example

use Aedart\Properties\Overload;

/**
 * @property string|null $name Name of a person
 */
class Person
{
    use Overload;
    
    protected string|null $name = null;
    
    public function getName() : string
    {
	    return $this->name;
    }

    public function setName(string $value)
    {
        if(empty($value)){
            throw new InvalidArgumentException('Provided name is invalid');
        }
        
        $this->name = $value;
        
        return $this;
    }
}

Elsewhere in your application, you can invoke the following:

$person = new Person();
$person->name = 'Alin'; // Invokes the setName(...)

echo $person->name;	// Invokes the getName(), then outputs 'Alin'
echo isset($person->name); // Invokes the __isset(), then outputs true

unset($person->name); // Invokes the __unset() and destroys the name property

Documentation

Please read the official documentation for additional information.

Repository

The mono repository is located at github.com/aedart/athenaeum

Versioning

This package follows Semantic Versioning 2.0.0

License

BSD-3-Clause, Read the LICENSE file included in this package

统计信息

  • 总下载量: 1.57k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2020-01-16