定制 f2/getset 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

f2/getset

Composer 安装命令:

composer require f2/getset

包简介

A trait `F2\GetSet` that implements getters and setters with public, protected and private visibility and type checking.

README 文档

README

Simple library that enables creating getters and setters with PHP in a consistent manner. Supports visibility and type hinting.

Simple getter and setter

<?php
class MyClass {
    use F2\GetSet;

    private $secret_value = "Initial value";

    /**
     * Any method that starts with "get_" is automatically a getter
     *
     * public, protected and private visibility is accepted and enforced.
     * Type checking is enforced by PHP automatically.
     */
    public function get_value(): string {
        return $this->secret_value;
    }

    /**
     * Any method that starts with "set_" is automatically a getter
     *
     * public, protected and private visibility is accepted and enforced.
     * Type checking is enforced by PHP automatically.
     */
    public function set_value(string $value): void {
        $this->secret_value = $value;
    }
}

$instance = new MyClass();

$instance->value .= ' and some more';
// Log: The property 'value' was read
// Log: The property 'value' was set to 'Initial value and some more'

## No dependencies

This library has no dependencies (except a development dependency f2/asserty)

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-01-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固