Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sweetchuck/cdd
Circular dependency detector
https://github.com/sweetchuck/cdd
lint tree tree-structure validator
Last synced: 3 months ago
JSON representation
Circular dependency detector
- Host: GitHub
- URL: https://github.com/sweetchuck/cdd
- Owner: Sweetchuck
- Created: 2018-11-30T22:24:22.000Z (about 6 years ago)
- Default Branch: 2.x
- Last Pushed: 2023-12-26T13:11:06.000Z (about 1 year ago)
- Last Synced: 2024-10-05T08:06:27.846Z (4 months ago)
- Topics: lint, tree, tree-structure, validator
- Language: PHP
- Size: 133 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Circular dependency detector
[![CircleCI](https://circleci.com/gh/Sweetchuck/cdd/tree/2.x.svg?style=svg)](https://circleci.com/gh/Sweetchuck/cdd/?branch=2.x)
[![codecov](https://codecov.io/gh/Sweetchuck/cdd/branch/2.x/graph/badge.svg?token=HSF16OGPyr)](https://app.codecov.io/gh/Sweetchuck/cdd/branch/2.x)## Install
composer require sweetchuck/cdd
## Usage
```php
[],// Item "b" depends on "c" and "d".
'b' => ['c', 'd'],// Item "c" has no any dependencies.
'c' => [],// Item "d" has no any dependencies.
'd' => [],
];$loops = $detector->detect($items);
/**
* $loops = [];
*/
var_dump($loops);$items = [
// Item "a" depends on "b".
'a' => ['b'],// Item "b" depends on "a".
'b' => ['a'],
];$loops = $detector->detect($items);
/**
* $loops = [
* 'a|b' => ['b', 'a', 'b'],
* ];
*/
var_dump($loops);$items = [
// Item "a" depends on "b".
'a' => ['b'],// Item "b" depends on "c".
'b' => ['c'],// Item "c" depends on "a".
'c' => ['a'],
];$loops = $detector->detect($items);
/**
* $loops = [
* 'a|b|c' => ['c', 'a', 'b', 'c'],
* ];
*/
var_dump($loops);
```