deoliveiralucas/copy-object-attributes-values
Composer 安装命令:
composer require deoliveiralucas/copy-object-attributes-values
包简介
Simple helper to copy attributes values with the same name from one object to an other.
README 文档
README
Simple helper to copy attributes values with the same name from one object to an other.
Installation
composer require deoliveiralucas/copy-object-attributes-values
Usage
use CopyObjectAttributesValues\CopyObjectAttributesValues; class ObjectA { private $attributeA = 'ObjectA_AttrA'; private $attributeB = 'ObjectA_AttrB'; } class ObjectB { private $attributeA = 'ObjectB_AttrA'; private $attributeB = 'ObjectB_AttrB'; private $attributeC = 'ObjectB_AttrC'; } $objectA = new ObjectA(); $objectB = new ObjectB(); CopyObjectAttributesValues::from($objectA)->to($objectB); var_dump($objectB); /* Output: class ObjectB#2 (3) { private $attributeA => string(13) "ObjectA_AttrA" private $attributeB => string(13) "ObjectA_AttrB" private $attributeC => string(13) "ObjectB_AttrC" } */
Contributing
Please see CONTRIBUTING for details.
License
CopyObjectAttributesValues is released under the MIT License. Please see License File for more information.
统计信息
- 总下载量: 26.07k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-04-27