Skip to content

Commit be6778b

Browse files
committed
Update code style based on new coding style conventions.
1 parent 42bf77c commit be6778b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+437
-437
lines changed

benchmarks/DrupolPhpTreeBench.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,6 @@ class DrupolPhpTreeBench extends AbstractBench
1818
*/
1919
private $tree;
2020

21-
/**
22-
* Init the object.
23-
*/
24-
public function initObject()
25-
{
26-
}
27-
2821
/**
2922
* @Revs({1, 100, 1000})
3023
* @Iterations(5)
@@ -38,4 +31,11 @@ public function benchTreeAdd()
3831
$this->tree->add(new ValueNode($value, 2));
3932
}
4033
}
34+
35+
/**
36+
* Init the object.
37+
*/
38+
public function initObject()
39+
{
40+
}
4141
}

spec/drupol/phptree/Exporter/AsciiSpec.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@
1111

1212
class AsciiSpec extends ObjectBehavior
1313
{
14-
public function it_is_initializable()
15-
{
16-
$this->shouldHaveType(Ascii::class);
17-
}
18-
1914
public function it_can_export_to_ascii()
2015
{
2116
$tree = new ValueNode('root', 2);
@@ -26,7 +21,7 @@ public function it_can_export_to_ascii()
2621

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

29-
$expected = <<<EOF
24+
$expected = <<<'EOF'
3025
├─ root
3126
└─┐
3227
├─┐
@@ -115,4 +110,9 @@ public function it_can_throw_an_error_when_tree_is_not_a_valuenode()
115110
->shouldThrow(\InvalidArgumentException::class)
116111
->during('export', [$tree]);
117112
}
113+
114+
public function it_is_initializable()
115+
{
116+
$this->shouldHaveType(Ascii::class);
117+
}
118118
}

spec/drupol/phptree/Exporter/GraphSpec.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@
1111

1212
class GraphSpec extends ObjectBehavior
1313
{
14-
public function it_is_initializable()
15-
{
16-
$this->shouldHaveType(Graph::class);
17-
}
18-
1914
public function it_can_generate_a_graph()
2015
{
2116
$root = new ValueNode('root');
@@ -43,7 +38,7 @@ public function it_can_generate_a_graph()
4338

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

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

@@ -52,7 +47,7 @@ public function it_can_generate_a_graph()
5247
->getVertices()
5348
->getVertexId(\spl_object_hash($node0))
5449
->hasEdgeTo($this->getGraph()->getVertices()->getVertexId(\spl_object_hash($node1)))
55-
->shouldReturn(TRUE);
50+
->shouldReturn(true);
5651
}
5752
}
5853

@@ -72,4 +67,9 @@ public function it_can_use_constructor_parameters()
7267
->getTraverser()
7368
->shouldReturn($traverser);
7469
}
70+
71+
public function it_is_initializable()
72+
{
73+
$this->shouldHaveType(Graph::class);
74+
}
7575
}

spec/drupol/phptree/Exporter/SimpleArraySpec.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@
1111

1212
class SimpleArraySpec extends ObjectBehavior
1313
{
14-
public function it_is_initializable()
15-
{
16-
$this->shouldHaveType(SimpleArray::class);
17-
}
18-
1914
public function it_can_export_to_an_array()
2015
{
2116
$tree = new ValueNode('root', 2);
@@ -94,4 +89,9 @@ public function it_can_throw_an_error_when_tree_is_not_a_valuenode()
9489
->shouldThrow(\InvalidArgumentException::class)
9590
->during('export', [$tree]);
9691
}
92+
93+
public function it_is_initializable()
94+
{
95+
$this->shouldHaveType(SimpleArray::class);
96+
}
9797
}

spec/drupol/phptree/Exporter/TextSpec.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@
1111

1212
class TextSpec extends ObjectBehavior
1313
{
14-
public function it_is_initializable()
15-
{
16-
$this->shouldHaveType(Text::class);
17-
}
18-
1914
public function it_can_export_to_text()
2015
{
2116
$tree = new ValueNode('root', 2);
@@ -30,7 +25,7 @@ public function it_can_export_to_text()
3025
}
3126

3227
$tree->add(...\array_values($nodes));
33-
28+
3429
$this
3530
->export($tree)
3631
->shouldReturn('[root [A [C [G] [H]] [D [I] [J]]] [B [E] [F]]]');
@@ -50,4 +45,9 @@ public function it_can_throw_an_error_when_tree_is_not_a_valuenode()
5045
->shouldThrow(\InvalidArgumentException::class)
5146
->during('export', [$tree]);
5247
}
48+
49+
public function it_is_initializable()
50+
{
51+
$this->shouldHaveType(Text::class);
52+
}
5353
}

spec/drupol/phptree/Importer/SimpleArraySpec.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@
1010

1111
class SimpleArraySpec extends ObjectBehavior
1212
{
13-
public function it_is_initializable()
14-
{
15-
$this->shouldHaveType(SimpleArray::class);
16-
}
17-
1813
public function it_can_import()
1914
{
2015
$array = [
@@ -41,6 +36,11 @@ public function it_can_import()
4136
$this
4237
->import($array)
4338
->isRoot()
44-
->shouldReturn(TRUE);
39+
->shouldReturn(true);
40+
}
41+
42+
public function it_is_initializable()
43+
{
44+
$this->shouldHaveType(SimpleArray::class);
4545
}
4646
}

spec/drupol/phptree/Importer/TextSpec.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@
1111

1212
class TextSpec extends ObjectBehavior
1313
{
14-
public function it_is_initializable()
15-
{
16-
$this->shouldHaveType(Text::class);
17-
}
18-
1914
public function it_can_import()
2015
{
2116
$string = '[root [A [C [G] [H]] [D [I] [J]]] [B [E] [F]]]';
@@ -41,7 +36,7 @@ public function it_can_import()
4136
$this
4237
->import($string)
4338
->isRoot()
44-
->shouldReturn(TRUE);
39+
->shouldReturn(true);
4540

4641
$this
4742
->import($string)
@@ -57,4 +52,9 @@ public function it_can_throw_an_error_when_cannot_import()
5752
->shouldThrow(\InvalidArgumentException::class)
5853
->during('import', [$string]);
5954
}
55+
56+
public function it_is_initializable()
57+
{
58+
$this->shouldHaveType(Text::class);
59+
}
6060
}

spec/drupol/phptree/Modifier/ReverseSpec.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@
1010

1111
class ReverseSpec extends ObjectBehavior
1212
{
13-
public function it_is_initializable()
14-
{
15-
$this->shouldHaveType(Reverse::class);
16-
}
17-
1813
public function it_can_reverse_a_tree()
1914
{
2015
$tree1 = new ValueNode('root');
@@ -39,4 +34,9 @@ public function it_can_reverse_a_tree()
3934
->children()->current()->getValue()
4035
->shouldReturn('E');
4136
}
37+
38+
public function it_is_initializable()
39+
{
40+
$this->shouldHaveType(Reverse::class);
41+
}
4242
}

spec/drupol/phptree/Node/KeyValueNodeSpec.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@
99

1010
class KeyValueNodeSpec extends ObjectBehavior
1111
{
12-
public function it_is_initializable()
13-
{
14-
$this->shouldHaveType(KeyValueNode::class);
15-
}
16-
1712
public function it_can_be_set_with_a_key_and_value()
1813
{
1914
$this
@@ -36,4 +31,9 @@ public function it_can_throw_an_error_when_capacity_is_invalid()
3631
->capacity()
3732
->shouldReturn(0);
3833
}
34+
35+
public function it_is_initializable()
36+
{
37+
$this->shouldHaveType(KeyValueNode::class);
38+
}
3939
}

spec/drupol/phptree/Node/NaryNodeSpec.php

+14-14
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,19 @@
99

1010
class NaryNodeSpec extends ObjectBehavior
1111
{
12-
public function it_is_initializable()
12+
public function it_can_be_counted()
1313
{
14-
$this->shouldHaveType(NaryNode::class);
14+
$this->beConstructedWith(2);
15+
16+
foreach (\range('A', 'Z') as $value) {
17+
$node = new NaryNode(2);
18+
19+
$this->add($node);
20+
}
21+
22+
$this
23+
->count()
24+
->shouldReturn(26);
1525
}
1626

1727
public function it_can_get_the_capacity()
@@ -39,18 +49,8 @@ public function it_can_throw_an_error_when_capacity_is_invalid()
3949
->shouldReturn(0);
4050
}
4151

42-
public function it_can_be_counted()
52+
public function it_is_initializable()
4353
{
44-
$this->beConstructedWith(2);
45-
46-
foreach (\range('A', 'Z') as $value) {
47-
$node = new NaryNode(2);
48-
49-
$this->add($node);
50-
}
51-
52-
$this
53-
->count()
54-
->shouldReturn(26);
54+
$this->shouldHaveType(NaryNode::class);
5555
}
5656
}

0 commit comments

Comments
 (0)