Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
drupol committed Jan 1, 2020
1 parent 4a4b292 commit 6c0cb80
Show file tree
Hide file tree
Showing 69 changed files with 310 additions and 301 deletions.
84 changes: 47 additions & 37 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,54 @@
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions

on:
- pull_request
- push
- pull_request
- push

name: "Continuous Integration"

jobs:
grumphp:
name: "Grumphp"

runs-on: ubuntu-latest

strategy:
matrix:
php-binary:
- php7.1
- php7.2
- php7.3

steps:
- name: "Checkout"
uses: actions/checkout@master
with:
fetch-depth: 1

- name: "Composer install"
run: ${{ matrix.php-binary }} $(which composer) install --no-interaction --no-progress --no-suggest

- name: "Composer install lowest dependencies"
if: matrix.dependencies == 'lowest'
run: ${{ matrix.php-binary }} $(which composer) update --no-interaction --no-progress --no-suggest --prefer-lowest

- name: "Install Graphviz"
run: sudo apt-get install graphviz

- name: "Run Grumphp"
run: ${{ matrix.php-binary }} vendor/bin/grumphp run
env:
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}

- name: "Scrutinizer"
run: wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml
run:
name: "Grumphp"
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
php-versions: ['7.1', '7.2', '7.3', '7.4']

steps:
- name: Checkout
uses: actions/checkout@master
with:
fetch-depth: 1

- name: Install PHP
uses: shivammathur/setup-php@master
with:
php-version: ${{ matrix.php-versions }}
extensions: xdebug

- name: Get Composer Cache Directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache dependencies
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install Graphviz
uses: kamiazya/setup-graphviz@v1

- name: Install dependencies
run: composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader

- name: Run Grumphp
run: vendor/bin/grumphp run
env:
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}

- name: Scrutinizer
run: vendor/bin/ocular code-coverage:upload --format=php-clover build/logs/clover.xml
37 changes: 18 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
[![Latest Stable Version](https://img.shields.io/packagist/v/drupol/phptree.svg?style=flat-square)](https://packagist.org/packages/drupol/phptree)
[![GitHub stars](https://img.shields.io/github/stars/drupol/phptree.svg?style=flat-square)](https://packagist.org/packages/drupol/phptree)
[![Total Downloads](https://img.shields.io/packagist/dt/drupol/phptree.svg?style=flat-square)](https://packagist.org/packages/drupol/phptree)
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/drupol/phptree/Continuous%20Integration?style=flat-square)](https://github.com/drupol/phptree/actions)
[![Scrutinizer code quality](https://img.shields.io/scrutinizer/quality/g/drupol/phptree/master.svg?style=flat-square)](https://scrutinizer-ci.com/g/drupol/phptree/?branch=master)
[![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/drupol/phptree/master.svg?style=flat-square)](https://scrutinizer-ci.com/g/drupol/phptree/?branch=master)
[![Mutation testing badge](https://badge.stryker-mutator.io/github.com/drupol/phptree/master)](https://stryker-mutator.github.io)
[![License](https://img.shields.io/packagist/l/drupol/phptree.svg?style=flat-square)](https://packagist.org/packages/drupol/phptree)
[![Say Thanks!](https://img.shields.io/badge/Say-thanks-brightgreen.svg?style=flat-square)](https://saythanks.io/to/drupol)
[![Donate!](https://img.shields.io/badge/Donate-Paypal-brightgreen.svg?style=flat-square)](https://paypal.me/drupol)
[![Latest Stable Version](https://img.shields.io/packagist/v/loophp/phptree.svg?style=flat-square)](https://packagist.org/packages/loophp/phptree)
[![GitHub stars](https://img.shields.io/github/stars/loophp/phptree.svg?style=flat-square)](https://packagist.org/packages/loophp/phptree)
[![Total Downloads](https://img.shields.io/packagist/dt/loophp/phptree.svg?style=flat-square)](https://packagist.org/packages/loophp/phptree)
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/loophp/phptree/Continuous%20Integration?style=flat-square)](https://github.com/loophp/phptree/actions)
[![Scrutinizer code quality](https://img.shields.io/scrutinizer/quality/g/loophp/phptree/master.svg?style=flat-square)](https://scrutinizer-ci.com/g/loophp/phptree/?branch=master)
[![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/loophp/phptree/master.svg?style=flat-square)](https://scrutinizer-ci.com/g/loophp/phptree/?branch=master)
[![Mutation testing badge](https://badge.stryker-mutator.io/github.com/loophp/phptree/master)](https://stryker-mutator.github.io)
[![License](https://img.shields.io/packagist/l/loophp/phptree.svg?style=flat-square)](https://packagist.org/packages/loophp/phptree)
[![Donate!](https://img.shields.io/badge/Donate-Paypal-brightgreen.svg?style=flat-square)](https://paypal.me/loophp)

# PhpTree

Expand Down Expand Up @@ -49,11 +48,11 @@ Blog post: [https://not-a-number.io/2018/phptree-a-fast-tree-implementation](htt

## Installation

```composer require drupol/phptree```
```composer require loophp/phptree```

## Optional packages

* [drupol/launcher](https://github.com/drupol/launcher): To automatically open a resource using the proper application on your operating system.
* [loophp/launcher](https://github.com/loophp/launcher): To automatically open a resource using the proper application on your operating system.
* [graphp/graphp](https://github.com/graphp/graph): To export a tree into a Graph.

## Usage
Expand All @@ -63,11 +62,11 @@ Blog post: [https://not-a-number.io/2018/phptree-a-fast-tree-implementation](htt

declare(strict_types = 1);

use drupol\phptree\Exporter\Gv;
use drupol\phptree\Exporter\Image;
use drupol\phptree\Node\ValueNode;
use drupol\phptree\Exporter\Text;
use drupol\launcher\Launcher;
use loophp\phptree\Exporter\Gv;
use loophp\phptree\Exporter\Image;
use loophp\phptree\Node\ValueNode;
use loophp\phptree\Exporter\Text;
use loophp\launcher\Launcher;

include './vendor/autoload.php';

Expand Down Expand Up @@ -97,14 +96,14 @@ $exporter = new Image();
$imagePath = $exporter->setFormat('png')->export($tree);

// If you want to launch the image, you can use an optional package.
// do: composer require drupol/launcher
// do: composer require loophp/launcher
// then:
Launcher::open($imagePath);
```

## Code quality, tests and benchmarks

Every time changes are introduced into the library, [Github](https://github.com/drupol/phptree/actions) run the tests and the benchmarks.
Every time changes are introduced into the library, [Github](https://github.com/loophp/phptree/actions) run the tests and the benchmarks.

The library has tests written with [PHPSpec](http://www.phpspec.net/).
Feel free to check them out in the `spec` directory. Run `composer phpspec` to trigger the tests.
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/AbstractBench.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace drupol\phptree\benchmarks;
namespace loophp\phptree\benchmarks;

abstract class AbstractBench
{
Expand Down
8 changes: 4 additions & 4 deletions benchmarks/DrupolPhpTreeBench.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@

declare(strict_types=1);

namespace drupol\phptree\benchmarks;
namespace loophp\phptree\benchmarks;

use drupol\phptree\Node\ValueNode;
use loophp\phptree\Node\ValueNode;
use PhpBench\Benchmark\Metadata\Annotations\BeforeMethods;

/**
* @Groups({"drupol/phptree"})
* @Groups({"loophp/phptree"})
* @BeforeMethods({"initObject"})
*/
class DrupolPhpTreeBench extends AbstractBench
{
/**
* @var \drupol\phptree\Node\NodeInterface
* @var \loophp\phptree\Node\NodeInterface
*/
private $tree;

Expand Down
17 changes: 9 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "drupol/phptree",
"name": "loophp/phptree",
"type": "library",
"description": "An implementation of tree data structure",
"keywords": [
Expand All @@ -20,28 +20,29 @@
},
"require-dev": {
"drupol/launcher": "^2.2.2",
"drupol/php-conventions": "^1.6.10",
"drupol/php-conventions": "^1.6.11",
"drupol/phpmerkle": "^2.2",
"friends-of-phpspec/phpspec-code-coverage": "^4.3.2",
"graphp/graphviz": "^0.2",
"infection/infection": "^0.13.6 || ^0.15.0",
"phpbench/phpbench": "^0.16.10",
"phpspec/phpspec": "^5.1.2 || ^6.1",
"phptaskman/changelog": "^1.0"
"phpspec/phpspec": "^5.1.2 || ^6.1.1",
"phptaskman/changelog": "^1.0",
"scrutinizer/ocular": "^1.6.0"
},
"config": {
"sort-packages": true
},
"autoload": {
"psr-4": {
"drupol\\phptree\\": "src/"
"loophp\\phptree\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"drupol\\phptree\\tests\\": "tests/src/",
"drupol\\phptree\\benchmarks\\": "benchmarks/",
"spec\\drupol\\phptree\\": "spec/drupol/phptree/"
"loophp\\phptree\\tests\\": "tests/src/",
"loophp\\phptree\\benchmarks\\": "benchmarks/",
"spec\\loophp\\phptree\\": "spec/loophp/phptree/"
}
},
"scripts": {
Expand Down
3 changes: 1 addition & 2 deletions phpspec.yml.dist
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
formatter.name: pretty
extensions:
LeanPHP\PhpSpec\CodeCoverage\CodeCoverageExtension:
FriendsOfPhpSpec\PhpSpec\CodeCoverage\CodeCoverageExtension:
format:
- html
- clover
- php
- text
Expand Down
4 changes: 2 additions & 2 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
parameters:
checkMissingIterableValueType: false
ignoreErrors:
- '#Method drupol\\phptree\\Node\\MerkleNode::normalize\(\) should return drupol\\phptree\\Node\\MerkleNodeInterface but returns drupol\\phptree\\Node\\NodeInterface.#'
- '#Anonymous function should return drupol\\phptree\\Node\\MerkleNodeInterface but returns drupol\\phptree\\Node\\NodeInterface.#'
- '#Method loophp\\phptree\\Node\\MerkleNode::normalize\(\) should return loophp\\phptree\\Node\\MerkleNodeInterface but returns loophp\\phptree\\Node\\NodeInterface.#'
- '#Anonymous function should return loophp\\phptree\\Node\\MerkleNodeInterface but returns loophp\\phptree\\Node\\NodeInterface.#'
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

declare(strict_types=1);

namespace spec\drupol\phptree\Builder;
namespace spec\loophp\phptree\Builder;

use drupol\phptree\Builder\Random;
use drupol\phptree\Node\Node;
use drupol\phptree\Node\NodeInterface;
use loophp\phptree\Builder\Random;
use loophp\phptree\Node\Node;
use loophp\phptree\Node\NodeInterface;
use PhpSpec\ObjectBehavior;

class RandomSpec extends ObjectBehavior
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

declare(strict_types=1);

namespace spec\drupol\phptree\Exporter;
namespace spec\loophp\phptree\Exporter;

use drupol\phptree\Exporter\Ascii;
use drupol\phptree\Node\ValueNode;
use loophp\phptree\Exporter\Ascii;
use loophp\phptree\Node\ValueNode;
use PhpSpec\ObjectBehavior;

class AsciiSpec extends ObjectBehavior
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

declare(strict_types=1);

namespace spec\drupol\phptree\Exporter;
namespace spec\loophp\phptree\Exporter;

use drupol\phptree\Exporter\Graph;
use drupol\phptree\Importer\Text;
use drupol\phptree\Node\AttributeNode;
use drupol\phptree\Node\ValueNode;
use Graphp\GraphViz\GraphViz;
use loophp\phptree\Exporter\Graph;
use loophp\phptree\Importer\Text;
use loophp\phptree\Node\AttributeNode;
use loophp\phptree\Node\ValueNode;
use PhpSpec\ObjectBehavior;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

declare(strict_types=1);

namespace spec\drupol\phptree\Exporter;
namespace spec\loophp\phptree\Exporter;

use drupol\phptree\Exporter\Gv;
use drupol\phptree\Node\AttributeNode;
use drupol\phptree\Node\ValueNode;
use loophp\phptree\Exporter\Gv;
use loophp\phptree\Node\AttributeNode;
use loophp\phptree\Node\ValueNode;
use PhpSpec\ObjectBehavior;

class GvSpec extends ObjectBehavior
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

declare(strict_types=1);

namespace spec\drupol\phptree\Exporter;
namespace spec\loophp\phptree\Exporter;

use drupol\phptree\Exporter\Image;
use drupol\phptree\Node\ValueNode;
use loophp\phptree\Exporter\Image;
use loophp\phptree\Node\ValueNode;
use PhpSpec\ObjectBehavior;

class ImageSpec extends ObjectBehavior
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

declare(strict_types=1);

namespace spec\drupol\phptree\Exporter;
namespace spec\loophp\phptree\Exporter;

use drupol\phptree\Exporter\SimpleArray;
use drupol\phptree\Node\Node;
use drupol\phptree\Node\ValueNode;
use InvalidArgumentException;
use loophp\phptree\Exporter\SimpleArray;
use loophp\phptree\Node\Node;
use loophp\phptree\Node\ValueNode;
use PhpSpec\ObjectBehavior;

class SimpleArraySpec extends ObjectBehavior
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

declare(strict_types=1);

namespace spec\drupol\phptree\Exporter;
namespace spec\loophp\phptree\Exporter;

use drupol\phptree\Exporter\Text;
use drupol\phptree\Node\ValueNode;
use loophp\phptree\Exporter\Text;
use loophp\phptree\Node\ValueNode;
use PhpSpec\ObjectBehavior;

class TextSpec extends ObjectBehavior
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

declare(strict_types=1);

namespace spec\drupol\phptree\Importer;
namespace spec\loophp\phptree\Importer;

use drupol\phptree\Importer\SimpleArray;
use drupol\phptree\Node\NodeInterface;
use loophp\phptree\Importer\SimpleArray;
use loophp\phptree\Node\NodeInterface;
use PhpSpec\ObjectBehavior;

class SimpleArraySpec extends ObjectBehavior
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

declare(strict_types=1);

namespace spec\drupol\phptree\Importer;
namespace spec\loophp\phptree\Importer;

use drupol\phptree\Importer\Text;
use drupol\phptree\Node\ValueNode;
use drupol\phptree\Node\ValueNodeInterface;
use InvalidArgumentException;
use loophp\phptree\Importer\Text;
use loophp\phptree\Node\ValueNode;
use loophp\phptree\Node\ValueNodeInterface;
use PhpSpec\ObjectBehavior;

class TextSpec extends ObjectBehavior
Expand Down
Loading

0 comments on commit 6c0cb80

Please sign in to comment.