Skip to content

Commit

Permalink
Update code style based on new coding style conventions.
Browse files Browse the repository at this point in the history
  • Loading branch information
drupol committed Jan 22, 2019
1 parent 42bf77c commit be6778b
Show file tree
Hide file tree
Showing 44 changed files with 437 additions and 437 deletions.
14 changes: 7 additions & 7 deletions benchmarks/DrupolPhpTreeBench.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,6 @@ class DrupolPhpTreeBench extends AbstractBench
*/
private $tree;

/**
* Init the object.
*/
public function initObject()
{
}

/**
* @Revs({1, 100, 1000})
* @Iterations(5)
Expand All @@ -38,4 +31,11 @@ public function benchTreeAdd()
$this->tree->add(new ValueNode($value, 2));
}
}

/**
* Init the object.
*/
public function initObject()
{
}
}
12 changes: 6 additions & 6 deletions spec/drupol/phptree/Exporter/AsciiSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@

class AsciiSpec extends ObjectBehavior
{
public function it_is_initializable()
{
$this->shouldHaveType(Ascii::class);
}

public function it_can_export_to_ascii()
{
$tree = new ValueNode('root', 2);
Expand All @@ -26,7 +21,7 @@ public function it_can_export_to_ascii()

$tree->add(...\array_values($nodes));

$expected = <<<EOF
$expected = <<<'EOF'
├─ root
└─┐
├─┐
Expand Down Expand Up @@ -115,4 +110,9 @@ public function it_can_throw_an_error_when_tree_is_not_a_valuenode()
->shouldThrow(\InvalidArgumentException::class)
->during('export', [$tree]);
}

public function it_is_initializable()
{
$this->shouldHaveType(Ascii::class);
}
}
14 changes: 7 additions & 7 deletions spec/drupol/phptree/Exporter/GraphSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@

class GraphSpec extends ObjectBehavior
{
public function it_is_initializable()
{
$this->shouldHaveType(Graph::class);
}

public function it_can_generate_a_graph()
{
$root = new ValueNode('root');
Expand Down Expand Up @@ -43,7 +38,7 @@ public function it_can_generate_a_graph()

$nodes = \iterator_to_array($traverser->traverse($root));

for ($i = 0; $i < \count($nodes) - 1; $i++) {
for ($i = 0; \count($nodes) - 1 > $i; ++$i) {
$node0 = $nodes[0];
$node1 = $nodes[$i + 1];

Expand All @@ -52,7 +47,7 @@ public function it_can_generate_a_graph()
->getVertices()
->getVertexId(\spl_object_hash($node0))
->hasEdgeTo($this->getGraph()->getVertices()->getVertexId(\spl_object_hash($node1)))
->shouldReturn(TRUE);
->shouldReturn(true);
}
}

Expand All @@ -72,4 +67,9 @@ public function it_can_use_constructor_parameters()
->getTraverser()
->shouldReturn($traverser);
}

public function it_is_initializable()
{
$this->shouldHaveType(Graph::class);
}
}
10 changes: 5 additions & 5 deletions spec/drupol/phptree/Exporter/SimpleArraySpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@

class SimpleArraySpec extends ObjectBehavior
{
public function it_is_initializable()
{
$this->shouldHaveType(SimpleArray::class);
}

public function it_can_export_to_an_array()
{
$tree = new ValueNode('root', 2);
Expand Down Expand Up @@ -94,4 +89,9 @@ public function it_can_throw_an_error_when_tree_is_not_a_valuenode()
->shouldThrow(\InvalidArgumentException::class)
->during('export', [$tree]);
}

public function it_is_initializable()
{
$this->shouldHaveType(SimpleArray::class);
}
}
12 changes: 6 additions & 6 deletions spec/drupol/phptree/Exporter/TextSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@

class TextSpec extends ObjectBehavior
{
public function it_is_initializable()
{
$this->shouldHaveType(Text::class);
}

public function it_can_export_to_text()
{
$tree = new ValueNode('root', 2);
Expand All @@ -30,7 +25,7 @@ public function it_can_export_to_text()
}

$tree->add(...\array_values($nodes));

$this
->export($tree)
->shouldReturn('[root [A [C [G] [H]] [D [I] [J]]] [B [E] [F]]]');
Expand All @@ -50,4 +45,9 @@ public function it_can_throw_an_error_when_tree_is_not_a_valuenode()
->shouldThrow(\InvalidArgumentException::class)
->during('export', [$tree]);
}

public function it_is_initializable()
{
$this->shouldHaveType(Text::class);
}
}
12 changes: 6 additions & 6 deletions spec/drupol/phptree/Importer/SimpleArraySpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@

class SimpleArraySpec extends ObjectBehavior
{
public function it_is_initializable()
{
$this->shouldHaveType(SimpleArray::class);
}

public function it_can_import()
{
$array = [
Expand All @@ -41,6 +36,11 @@ public function it_can_import()
$this
->import($array)
->isRoot()
->shouldReturn(TRUE);
->shouldReturn(true);
}

public function it_is_initializable()
{
$this->shouldHaveType(SimpleArray::class);
}
}
12 changes: 6 additions & 6 deletions spec/drupol/phptree/Importer/TextSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@

class TextSpec extends ObjectBehavior
{
public function it_is_initializable()
{
$this->shouldHaveType(Text::class);
}

public function it_can_import()
{
$string = '[root [A [C [G] [H]] [D [I] [J]]] [B [E] [F]]]';
Expand All @@ -41,7 +36,7 @@ public function it_can_import()
$this
->import($string)
->isRoot()
->shouldReturn(TRUE);
->shouldReturn(true);

$this
->import($string)
Expand All @@ -57,4 +52,9 @@ public function it_can_throw_an_error_when_cannot_import()
->shouldThrow(\InvalidArgumentException::class)
->during('import', [$string]);
}

public function it_is_initializable()
{
$this->shouldHaveType(Text::class);
}
}
10 changes: 5 additions & 5 deletions spec/drupol/phptree/Modifier/ReverseSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@

class ReverseSpec extends ObjectBehavior
{
public function it_is_initializable()
{
$this->shouldHaveType(Reverse::class);
}

public function it_can_reverse_a_tree()
{
$tree1 = new ValueNode('root');
Expand All @@ -39,4 +34,9 @@ public function it_can_reverse_a_tree()
->children()->current()->getValue()
->shouldReturn('E');
}

public function it_is_initializable()
{
$this->shouldHaveType(Reverse::class);
}
}
10 changes: 5 additions & 5 deletions spec/drupol/phptree/Node/KeyValueNodeSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@

class KeyValueNodeSpec extends ObjectBehavior
{
public function it_is_initializable()
{
$this->shouldHaveType(KeyValueNode::class);
}

public function it_can_be_set_with_a_key_and_value()
{
$this
Expand All @@ -36,4 +31,9 @@ public function it_can_throw_an_error_when_capacity_is_invalid()
->capacity()
->shouldReturn(0);
}

public function it_is_initializable()
{
$this->shouldHaveType(KeyValueNode::class);
}
}
28 changes: 14 additions & 14 deletions spec/drupol/phptree/Node/NaryNodeSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,19 @@

class NaryNodeSpec extends ObjectBehavior
{
public function it_is_initializable()
public function it_can_be_counted()
{
$this->shouldHaveType(NaryNode::class);
$this->beConstructedWith(2);

foreach (\range('A', 'Z') as $value) {
$node = new NaryNode(2);

$this->add($node);
}

$this
->count()
->shouldReturn(26);
}

public function it_can_get_the_capacity()
Expand Down Expand Up @@ -39,18 +49,8 @@ public function it_can_throw_an_error_when_capacity_is_invalid()
->shouldReturn(0);
}

public function it_can_be_counted()
public function it_is_initializable()
{
$this->beConstructedWith(2);

foreach (\range('A', 'Z') as $value) {
$node = new NaryNode(2);

$this->add($node);
}

$this
->count()
->shouldReturn(26);
$this->shouldHaveType(NaryNode::class);
}
}

0 comments on commit be6778b

Please sign in to comment.