コード例 #1
0
ファイル: ImmutableMapTest.php プロジェクト: hoesler/traver
 /**
  * @dataProvider copyOfProvider
  * @covers ::copyOf
  * @param $traversable
  */
 public function testCopyOf($traversable)
 {
     // when
     $vector = ImmutableMap::copyOf($traversable);
     // then
     self::assertInstanceOf(ImmutableMap::class, $vector);
     $expected = is_array($traversable) ? $traversable : iterator_to_array($traversable);
     $actual = iterator_to_array($vector);
     self::assertEquals($expected, $actual);
 }
コード例 #2
0
ファイル: functions.php プロジェクト: hoesler/traver
 /**
  * Creates a new {@link ImmutableMap} from the given elements.
  * @param array|Traversable $collection
  * @return ImmutableMap
  * @see map alias
  */
 function in($collection)
 {
     return ImmutableMap::copyOf($collection);
 }
コード例 #3
0
ファイル: ImmutableMap.php プロジェクト: hoesler/traver
 public function build()
 {
     return ImmutableMap::copyOf($this->array);
 }