承接 timostamm/data-tree 相关项目开发

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

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

timostamm/data-tree

Composer 安装命令:

composer require timostamm/data-tree

包简介

README 文档

README

This library provides a tree structure via discrete Traits.

It is intended to be used by other libraries.

ChildrenTrait

Add, acces and remove child nodes using this trait.

LookupTrait

Optional methods to inspect the tree.

AttributesTrait

Optional attributes per node.

ToStringTrait

Optional __toString() implementation that outputs the nodes class name and its attributes.

NodeTrait

Combines all of the above traits

Protected Access

The sub-namespace ProtectedAccess contains versions of ChildrenTrait, LookupTrait and AttributesTrait where all methods are protected. This allows fine control over the public API when using the Traits in a library.

Example

// Create a simple tree.
$root = new Node();
$root->setAttribute('name', 'root');

$a = new Node();
$a->setAttribute('name', 'a');
$root->addChild($a);

$b = new Node();
$b->setAttribute('name', 'b');
$root->addChild($b);

$c = new Node();
$c->setAttribute('name', 'c');
$root->addChild($c);


// Find a descendant with the name=b
$bAgain = $root->descendant(function ($node) {
	return $node->getAttribute('name') === 'b';
});

// Get the root node of any node
$rootAgain = $bAgain->findRootNode();

// Remove a node
$bAgain->remove();
$root->removeChild($a);
$root->removeChildAt(0);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: AGPL-3.0
  • 更新时间: 2017-10-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固