You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
PhpCollections/tests/test.php

27 lines
774 B
PHP

<?php
use jrosset\Collections\ImmutableCollection;
use jrosset\Collections\InsensitiveCaseKeyCollection;
use jrosset\Collections\InsensitiveCaseKeyImmutableCollection;
require_once __DIR__ . '/../vendor/autoload.php';
$readOnlyCollection = new InsensitiveCaseKeyImmutableCollection(
[
'Foo' => 'bar',
'foo' => 'foobar',
]
);
echo 'Size : ' . $readOnlyCollection->count() . PHP_EOL;
echo 'Foo = ' . $readOnlyCollection->get('Foo') . PHP_EOL;
echo '-----' . PHP_EOL;
$collection = new InsensitiveCaseKeyCollection($readOnlyCollection);
$collection->add(28);
echo 'Size : ' . $collection->count() . PHP_EOL;
echo 'Fill :' . PHP_EOL;
foreach (ImmutableCollection::fill(5, -1) as $key => $value) {
echo "\t#" . $key . ' = ' . $value . PHP_EOL;
}