Completed
Push — master ( a7a4b1...4dab2b )
by Shcherbak
25:32 queued 10:30
created

CombinedStringList::all()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
  declare(strict_types=1);
4
5
  namespace Funivan\CabbageCore\String\StringList\Combined;
6
7
  use Funivan\CabbageCore\String\StringList\StringListInterface;
8
9
  class CombinedStringList implements StringListInterface {
10
11
    /**
12
     * @var string[]
13
     */
14
    private $values;
15
16
17
    public function __construct(StringListInterface ...$items) {
18
      $values = [];
19
      foreach ($items as $item) {
20
        $values = array_merge($values, iterator_to_array($item->all()));
21
      }
22
      $this->values = $values;
23
    }
24
25
26
    /**
27
     * @return string[]|\Generator
28
     */
29
    public function all(): \Generator {
30
      yield from $this->values;
31
    }
32
  }