Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ on:
jobs:
code-style:
name: Code Style & Static Analysis
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand All @@ -32,18 +32,22 @@ jobs:

tests:
name: Test Suite
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
strategy:
max-parallel: 10
matrix:
php:
- 7.4
- 8.0
- 8.1
- 8.2
- 8.3
- 8.4
- 8.5

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"require": {
"php": ">=7.4",
"bentools/cartesian-product": "^1.1"
"bentools/cartesian-product": "^1.5|^2.0"
},
"require-dev": {
"phpunit/phpunit": "^8.0|^9.0",
Expand Down
6 changes: 3 additions & 3 deletions src/StringCombinations.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace BenTools\StringCombinations;

use function BenTools\CartesianProduct\cartesian_product;
use function BenTools\CartesianProduct\combinations;
use Countable;
use IteratorAggregate;
use Traversable;
Expand Down Expand Up @@ -54,7 +54,7 @@ public function count(): int
{
if (null === $this->count) {
$this->count = array_sum(array_map(function ($set) {
return count(cartesian_product($set));
return count(combinations($set));
}, iterator_to_array($this->generateSets())));
}
return $this->count;
Expand All @@ -63,7 +63,7 @@ public function count(): int
public function getIterator(): Traversable
{
foreach ($this->generateSets() as $set) {
foreach (cartesian_product($set) as $combination) {
foreach (combinations($set) as $combination) {
yield implode($this->glue, $combination);
}
}
Expand Down