Skip to content
This repository has been archived by the owner on Mar 11, 2024. It is now read-only.

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
* develop:
  add object graph in doc
  add tool to generate object graph
  CS
  CS
  use innmind/specification 2
  use dbal 5
  test against php 7.3
  • Loading branch information
Baptouuuu committed Jan 8, 2019
2 parents b3981b0 + ccdb657 commit 4241ed8
Show file tree
Hide file tree
Showing 89 changed files with 4,236 additions and 854 deletions.
3 changes: 2 additions & 1 deletion .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
tools:
external_code_coverage:
runs: 1
runs: 2
filter:
excluded_paths:
- tests/*
- graph.php
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
language: php
php:
- 7.2
- 7.3
- nightly
matrix:
allow_failures:
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,3 +282,7 @@ $services = bootstrap(
(MyIdentity::class, new MyIdentityGenerator)
);
```

## Object graph

![](graph.svg)
9 changes: 6 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
},
"require": {
"php": "~7.2",
"innmind/neo4j-dbal": "~4.0",
"innmind/neo4j-dbal": "~5.0",
"innmind/immutable": "~2.10",
"ramsey/uuid": "^3.2",
"innmind/reflection": "~3.0",
"innmind/specification": "^1.0",
"innmind/specification": "~2.0",
"innmind/event-bus": "~3.0"
},
"autoload": {
Expand All @@ -38,7 +38,10 @@
"require-dev": {
"phpunit/phpunit": "~7.0",
"innmind/time-continuum": "^1.0",
"innmind/command-bus": "^3.0"
"innmind/command-bus": "^3.0",
"innmind/cli": "^1.5",
"innmind/object-graph": "^1.2",
"innmind/server-control": "^2.7"
},
"scripts": {
"test": "vendor/bin/phpunit --colors=always"
Expand Down
16 changes: 8 additions & 8 deletions fixtures/Specification/Composite.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
namespace Fixtures\Innmind\Neo4j\ONM\Specification;

use Innmind\Specification\{
SpecificationInterface,
Specification,
Operator,
CompositeInterface
Composite as CompositeInterface,
};

class Composite implements CompositeInterface
Expand All @@ -18,21 +18,21 @@ class Composite implements CompositeInterface
private $operator;

public function __construct(
SpecificationInterface $left,
SpecificationInterface $right,
string $operator
Specification $left,
Specification $right,
Operator $operator
) {
$this->left = $left;
$this->right = $right;
$this->operator = new Operator($operator);
$this->operator = $operator;
}

public function left(): SpecificationInterface
public function left(): Specification
{
return $this->left;
}

public function right(): SpecificationInterface
public function right(): Specification
{
return $this->right;
}
Expand Down
16 changes: 8 additions & 8 deletions fixtures/Specification/CompositeTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@
namespace Fixtures\Innmind\Neo4j\ONM\Specification;

use Innmind\Specification\{
SpecificationInterface,
CompositeInterface,
NotInterface,
Operator
Specification,
Composite as CompositeInterface,
Not as NotInterface,
Operator,
};

trait CompositeTrait
{
public function and(SpecificationInterface $spec): CompositeInterface
public function and(Specification $spec): CompositeInterface
{
return new Composite($this, $spec, Operator::AND);
return new Composite($this, $spec, Operator::and());
}

public function or(SpecificationInterface $spec): CompositeInterface
public function or(Specification $spec): CompositeInterface
{
return new Composite($this, $spec, Operator::OR);
return new Composite($this, $spec, Operator::or());
}

public function not(): NotInterface
Expand Down
8 changes: 4 additions & 4 deletions fixtures/Specification/Not.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
namespace Fixtures\Innmind\Neo4j\ONM\Specification;

use Innmind\Specification\{
NotInterface,
SpecificationInterface
Not as NotInterface,
Specification
};

class Not implements NotInterface
Expand All @@ -14,12 +14,12 @@ class Not implements NotInterface

private $specification;

public function __construct(SpecificationInterface $specification)
public function __construct(Specification $specification)
{
$this->specification = $specification;
}

public function specification(): SpecificationInterface
public function specification(): Specification
{
return $this->specification;
}
Expand Down
11 changes: 7 additions & 4 deletions fixtures/Specification/Property.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,20 @@

namespace Fixtures\Innmind\Neo4j\ONM\Specification;

use Innmind\Specification\ComparatorInterface;
use Innmind\Specification\{
Comparator,
Sign,
};

class Property implements ComparatorInterface
class Property implements Comparator
{
use CompositeTrait;

private $property;
private $sign;
private $value;

public function __construct(string $property, string $sign, $value)
public function __construct(string $property, Sign $sign, $value)
{
$this->property = $property;
$this->sign = $sign;
Expand All @@ -25,7 +28,7 @@ public function property(): string
return $this->property;
}

public function sign(): string
public function sign(): Sign
{
return $this->sign;
}
Expand Down
49 changes: 49 additions & 0 deletions graph.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php
declare(strict_types = 1);

require __DIR__.'/vendor/autoload.php';

use Innmind\CLI\{
Main,
Environment,
};
use Innmind\OperatingSystem\OperatingSystem;
use Innmind\Neo4j\ONM\Metadata\Entity;
use function Innmind\Neo4j\ONM\bootstrap;
use function Innmind\Neo4j\DBAL\bootstrap as dbal;
use Innmind\Server\Control\Server\Command;
use Innmind\ObjectGraph\{
Graph,
Visualize,
};
use Innmind\Immutable\Set;

new class extends Main {
protected function main(Environment $env, OperatingSystem $os): void
{
$dbal = dbal(
$os->remote()->http(),
$os->clock()
);
$package = bootstrap(
$dbal,
Set::of(Entity::class)
);

$graph = new Graph;
$visualize = new Visualize;

$os
->control()
->processes()
->execute(
Command::foreground('dot')
->withShortOption('Tsvg')
->withShortOption('o', 'graph.svg')
->withInput(
$visualize($graph($package['manager']))
)
)
->wait();
}
};

0 comments on commit 4241ed8

Please sign in to comment.