seotils/has-parent
Composer 安装命令:
composer require seotils/has-parent
包简介
The trait allows set and get parent class of instance.
关键字:
README 文档
README
Description
This trait assigns parent to a class.
License
HasParent is open-sourced software licensed under the [GPL-3.0] (https://www.gnu.org/licenses/gpl-3.0.en.html).
Requirements
Package depends on deferred-exceptions package.
-
GitHub:
- [seotils/deferred-exceptions] (https://github.com/seotils/deferred-exceptions)
-
Composer (packagist.org):
- [seotils/deferred-exceptions] (https://packagist.org/packages/seotils/deferred-exceptions)
-
PHPClasses:
- [Deferred Exceptions] (http://www.phpclasses.org/package/9854-PHP-Queue-exceptions-and-throws-them-afterwards.html)
Install
composer require seotils/has-parent
Usage
<?php namespace My; use Seotils\Traits\HasParent; /** * Parent class */ class A { public function time(){ return date('Y-m-d H:i:s'); } } /** * Class with HasParent trait */ class B { use HasParent; } // Usage $a = new A(); $b = new B(); // Assign and use parent class echo $b->parentClass( $a )->time(); // Or step by step // Assign parent class $b->parentClass( $a ); // Use parent class echo $b->parentClass()->time();
That`s all!
统计信息
- 总下载量: 30
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0
- 更新时间: 2016-09-03