Skip to content

Commit 898aad6

Browse files
Pol DellaieraPol Dellaiera
authored andcommitted
#3: Fix PHPCS errors.
1 parent f7e6dad commit 898aad6

File tree

6 files changed

+13
-30
lines changed

6 files changed

+13
-30
lines changed

src/Generators/Combinations.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
* @package drupol\phpermutations\Generators
1111
*
12-
* @author Mark Wilson <[email protected]>
12+
* @author Mark Wilson <[email protected]>
1313
*/
1414
class Combinations extends CombinationsIterator {
1515

@@ -28,19 +28,22 @@ public function generator() {
2828
*
2929
* @param array $dataset
3030
* The dataset.
31+
* @param int $length
32+
* The length.
3133
*
3234
* @codingStandardsIgnoreStart
3335
* @return \Generator
3436
* @codingStandardsIgnoreEnd
3537
*/
3638
protected function get(array $dataset, $length) {
37-
$originalLength = count($dataset);
39+
$originalLength = count($dataset);
3840
$remainingLength = $originalLength - $length + 1;
3941
for ($i = 0; $i < $remainingLength; $i++) {
4042
$current = $dataset[$i];
4143
if ($length === 1) {
4244
yield [$current];
43-
} else {
45+
}
46+
else {
4447
$remaining = array_slice($dataset, $i + 1);
4548
foreach ($this->get($remaining, $length - 1) as $permutation) {
4649
array_unshift($permutation, $current);

src/Generators/Permutations.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@
22

33
namespace drupol\phpermutations\Generators;
44

5-
use drupol\phpermutations\Iterators\RangeIterator;
65
use drupol\phpermutations\Permutations as PermutationsClass;
76

87
/**
98
* Class Permutations.
109
*
1110
* @package drupol\phpermutations\Generators
1211
*
13-
* @author Mark Wilson <[email protected]>
12+
* @author Mark Wilson <[email protected]>
1413
*/
1514
class Permutations extends PermutationsClass {
1615

src/Iterators/Cycle.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,6 @@ class Cycle extends Combinatorics implements \Iterator, \Countable {
1818
*/
1919
protected $key = 0;
2020

21-
/**
22-
* Cycle constructor.
23-
*
24-
* @param array $dataset
25-
* The dataset.
26-
*/
27-
public function __construct(array $dataset = array()) {
28-
parent::__construct($dataset);
29-
}
30-
3121
/**
3222
* {@inheritdoc}
3323
*/

src/Iterators/FiniteGroup.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,18 @@ private function gcd($a, $b) {
146146
}
147147

148148
/**
149-
* @param $generator
149+
* Get the order.
150+
*
151+
* @param int $generator
152+
* The generator.
150153
*
151154
* @return int
155+
* The order.
152156
*/
153157
public function order($generator) {
154158
$result = array();
155159

156-
foreach(range(1, $this->getSize() - 1) as $number) {
160+
foreach (range(1, $this->getSize() - 1) as $number) {
157161
$value = pow($generator, $number) % $this->getSize();
158162
$result[$value] = $value;
159163
}

src/Permutations.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,6 @@
1111
*/
1212
class Permutations extends Combinatorics {
1313

14-
/**
15-
* Permutations constructor.
16-
*
17-
* @param array $dataset
18-
* The dataset.
19-
* @param int $length
20-
* The length of the requested permutations.
21-
*/
22-
public function __construct(array $dataset = array(), $length = NULL) {
23-
parent::__construct($dataset, $length);
24-
}
25-
2614
/**
2715
* Count the number of permutations.
2816
*

tests/src/Generators/CombinationsTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace drupol\phpermutations\Tests\Generators;
44

55
use drupol\phpermutations\Generators\Combinations;
6-
use drupol\phpermutations\Permutations;
76
use PHPUnit\Framework\TestCase;
87

98
/**

0 commit comments

Comments
 (0)