keradus/traits 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

keradus/traits

最新稳定版本:v1.0

Composer 安装命令:

composer require keradus/traits

包简介

Traits: general usage traits

README 文档

README

Latest Stable Version Latest Unstable Version Build status SensioLabsInsight

Traits - general usage traits.

Traits List

InaccessiblePropertiesProtectorTrait

Trait, that protects accessing inaccessible (unknown) properties to help keeping code clean and safe.

class Foo
{
    public $baz;
}

$foo = new Foo();
$foo->vaz = 123; // PHP claims that code is OK, even if you misspelled variable name!

class Bar
{
    use InaccessiblePropertiesProtectorTrait;

    public $baz;
}

$bar = new Bar();
$bar->vaz = 123; // now PHP throws \LogicException

InnerClassCacheTrait

Trait, that adds functionality of inner class cache.

class Foo
{
    use InnerClassCacheTrait;

    public function square($x)
    {
        if (!isset($this->cache[$x])) {
            $this->cache[$x] = $x * $x;
        }

        return $this->cache[$x];
    }
}

InstanceCreationDisallowerTrait

Trait, that disallow to create instance of class. Use for protecting static classes (only static members).

class Foo
{
    use InstanceCreationDisallowerTrait;

    public static function createInstance()
    {
        return new static();
    }
}

$foo = new Foo(); // PHP throws fatal error
$foo = Foo::createInstance(); // PHP throws \LogicException

PropertyTrait

Property trait.

SingletonTrait

StaticPropertyTrait

Property trait in static way.

统计信息

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

GitHub 信息

  • Stars: 14
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-11-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固