Skip to content
This repository has been archived by the owner on May 28, 2019. It is now read-only.

Commit

Permalink
Merge branch 'release/0.8.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
jmalloc committed Sep 23, 2013
2 parents cf35e1b + f6497bf commit c12f606
Show file tree
Hide file tree
Showing 25 changed files with 563 additions and 404 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Collections Changelog

### 0.8.0 (2013-09-23)

* **[BC]** Changed `Vector`, `Map`, `HashMap` and `LinkedList` to implement `IteratorAggregate` instead of `Iterator` to prevent issues with nested iteration
* **[NEW]** Added `Collection::trySize()`

### 0.7.1 (2013-09-21)

* **[FIXED]** Fixed issue with `Vector::compare()` whereby equal vectors with differing internal array sizes were not considered equal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ collection produces a copy of the collection containing the same elements. The e
<!-- references -->
[Build Status]: https://travis-ci.org/IcecaveStudios/collections.png?branch=develop
[Test Coverage]: https://coveralls.io/repos/IcecaveStudios/collections/badge.png?branch=develop
[SemVer]: http://calm-shore-6115.herokuapp.com/?label=semver&value=0.7.1&color=yellow
[SemVer]: http://calm-shore-6115.herokuapp.com/?label=semver&value=0.8.0&color=yellow
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@ public function size(array $arguments)
}
}

public function trySize(array $arguments)
{
$argumentCount = \count($arguments);
if ($argumentCount < 1) {
throw new \Icecave\Collections\TypeCheck\Exception\MissingArgumentException('collection', 0, 'mixed');
} elseif ($argumentCount > 1) {
throw new \Icecave\Collections\TypeCheck\Exception\UnexpectedArgumentException(1, $arguments[1]);
}
}

public function get(array $arguments)
{
$argumentCount = \count($arguments);
Expand Down Expand Up @@ -887,14 +897,4 @@ public function binarySearch(array $arguments)
}
}

public function trySize(array $arguments)
{
$argumentCount = \count($arguments);
if ($argumentCount < 1) {
throw new \Icecave\Collections\TypeCheck\Exception\MissingArgumentException('collection', 0, 'mixed');
} elseif ($argumentCount > 1) {
throw new \Icecave\Collections\TypeCheck\Exception\UnexpectedArgumentException(1, $arguments[1]);
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php
namespace Icecave\Collections\TypeCheck\Validator\Icecave\Collections\Detail;

class LinkedListIteratorTypeCheck extends \Icecave\Collections\TypeCheck\AbstractValidator
{
public function validateConstruct(array $arguments)
{
$argumentCount = \count($arguments);
if ($argumentCount > 2) {
throw new \Icecave\Collections\TypeCheck\Exception\UnexpectedArgumentException(2, $arguments[2]);
}
}

public function current(array $arguments)
{
if (\count($arguments) > 0) {
throw new \Icecave\Collections\TypeCheck\Exception\UnexpectedArgumentException(0, $arguments[0]);
}
}

public function key(array $arguments)
{
if (\count($arguments) > 0) {
throw new \Icecave\Collections\TypeCheck\Exception\UnexpectedArgumentException(0, $arguments[0]);
}
}

public function next(array $arguments)
{
if (\count($arguments) > 0) {
throw new \Icecave\Collections\TypeCheck\Exception\UnexpectedArgumentException(0, $arguments[0]);
}
}

public function rewind(array $arguments)
{
if (\count($arguments) > 0) {
throw new \Icecave\Collections\TypeCheck\Exception\UnexpectedArgumentException(0, $arguments[0]);
}
}

public function valid(array $arguments)
{
if (\count($arguments) > 0) {
throw new \Icecave\Collections\TypeCheck\Exception\UnexpectedArgumentException(0, $arguments[0]);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -642,35 +642,7 @@ public function count(array $arguments)
}
}

public function current(array $arguments)
{
if (\count($arguments) > 0) {
throw new \Icecave\Collections\TypeCheck\Exception\UnexpectedArgumentException(0, $arguments[0]);
}
}

public function key(array $arguments)
{
if (\count($arguments) > 0) {
throw new \Icecave\Collections\TypeCheck\Exception\UnexpectedArgumentException(0, $arguments[0]);
}
}

public function next(array $arguments)
{
if (\count($arguments) > 0) {
throw new \Icecave\Collections\TypeCheck\Exception\UnexpectedArgumentException(0, $arguments[0]);
}
}

public function rewind(array $arguments)
{
if (\count($arguments) > 0) {
throw new \Icecave\Collections\TypeCheck\Exception\UnexpectedArgumentException(0, $arguments[0]);
}
}

public function valid(array $arguments)
public function getIterator(array $arguments)
{
if (\count($arguments) > 0) {
throw new \Icecave\Collections\TypeCheck\Exception\UnexpectedArgumentException(0, $arguments[0]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,23 @@ public function valid(array $arguments)
}
}

public function seek(array $arguments)
{
$argumentCount = \count($arguments);
if ($argumentCount < 1) {
throw new \Icecave\Collections\TypeCheck\Exception\MissingArgumentException('index', 0, 'integer');
} elseif ($argumentCount > 1) {
throw new \Icecave\Collections\TypeCheck\Exception\UnexpectedArgumentException(1, $arguments[1]);
}
$value = $arguments[0];
if (!\is_int($value)) {
throw new \Icecave\Collections\TypeCheck\Exception\UnexpectedArgumentValueException(
'index',
0,
$arguments[0],
'integer'
);
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php
namespace Icecave\Collections\TypeCheck\Validator\Icecave\Collections\Iterator;

class UnpackIteratorTypeCheck extends \Icecave\Collections\TypeCheck\AbstractValidator
{
public function validateConstruct(array $arguments)
{
$argumentCount = \count($arguments);
if ($argumentCount < 1) {
throw new \Icecave\Collections\TypeCheck\Exception\MissingArgumentException('iterator', 0, 'Iterator');
} elseif ($argumentCount > 1) {
throw new \Icecave\Collections\TypeCheck\Exception\UnexpectedArgumentException(1, $arguments[1]);
}
}

public function getInnerIterator(array $arguments)
{
if (\count($arguments) > 0) {
throw new \Icecave\Collections\TypeCheck\Exception\UnexpectedArgumentException(0, $arguments[0]);
}
}

public function current(array $arguments)
{
if (\count($arguments) > 0) {
throw new \Icecave\Collections\TypeCheck\Exception\UnexpectedArgumentException(0, $arguments[0]);
}
}

public function key(array $arguments)
{
if (\count($arguments) > 0) {
throw new \Icecave\Collections\TypeCheck\Exception\UnexpectedArgumentException(0, $arguments[0]);
}
}

public function next(array $arguments)
{
if (\count($arguments) > 0) {
throw new \Icecave\Collections\TypeCheck\Exception\UnexpectedArgumentException(0, $arguments[0]);
}
}

public function rewind(array $arguments)
{
if (\count($arguments) > 0) {
throw new \Icecave\Collections\TypeCheck\Exception\UnexpectedArgumentException(0, $arguments[0]);
}
}

public function valid(array $arguments)
{
if (\count($arguments) > 0) {
throw new \Icecave\Collections\TypeCheck\Exception\UnexpectedArgumentException(0, $arguments[0]);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -1109,35 +1109,7 @@ public function count(array $arguments)
}
}

public function current(array $arguments)
{
if (\count($arguments) > 0) {
throw new \Icecave\Collections\TypeCheck\Exception\UnexpectedArgumentException(0, $arguments[0]);
}
}

public function key(array $arguments)
{
if (\count($arguments) > 0) {
throw new \Icecave\Collections\TypeCheck\Exception\UnexpectedArgumentException(0, $arguments[0]);
}
}

public function next(array $arguments)
{
if (\count($arguments) > 0) {
throw new \Icecave\Collections\TypeCheck\Exception\UnexpectedArgumentException(0, $arguments[0]);
}
}

public function rewind(array $arguments)
{
if (\count($arguments) > 0) {
throw new \Icecave\Collections\TypeCheck\Exception\UnexpectedArgumentException(0, $arguments[0]);
}
}

public function valid(array $arguments)
public function getIterator(array $arguments)
{
if (\count($arguments) > 0) {
throw new \Icecave\Collections\TypeCheck\Exception\UnexpectedArgumentException(0, $arguments[0]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -649,35 +649,7 @@ public function count(array $arguments)
}
}

public function current(array $arguments)
{
if (\count($arguments) > 0) {
throw new \Icecave\Collections\TypeCheck\Exception\UnexpectedArgumentException(0, $arguments[0]);
}
}

public function key(array $arguments)
{
if (\count($arguments) > 0) {
throw new \Icecave\Collections\TypeCheck\Exception\UnexpectedArgumentException(0, $arguments[0]);
}
}

public function next(array $arguments)
{
if (\count($arguments) > 0) {
throw new \Icecave\Collections\TypeCheck\Exception\UnexpectedArgumentException(0, $arguments[0]);
}
}

public function rewind(array $arguments)
{
if (\count($arguments) > 0) {
throw new \Icecave\Collections\TypeCheck\Exception\UnexpectedArgumentException(0, $arguments[0]);
}
}

public function valid(array $arguments)
public function getIterator(array $arguments)
{
if (\count($arguments) > 0) {
throw new \Icecave\Collections\TypeCheck\Exception\UnexpectedArgumentException(0, $arguments[0]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1109,60 +1109,13 @@ public function count(array $arguments)
}
}

public function current(array $arguments)
public function getIterator(array $arguments)
{
if (\count($arguments) > 0) {
throw new \Icecave\Collections\TypeCheck\Exception\UnexpectedArgumentException(0, $arguments[0]);
}
}

public function key(array $arguments)
{
if (\count($arguments) > 0) {
throw new \Icecave\Collections\TypeCheck\Exception\UnexpectedArgumentException(0, $arguments[0]);
}
}

public function next(array $arguments)
{
if (\count($arguments) > 0) {
throw new \Icecave\Collections\TypeCheck\Exception\UnexpectedArgumentException(0, $arguments[0]);
}
}

public function rewind(array $arguments)
{
if (\count($arguments) > 0) {
throw new \Icecave\Collections\TypeCheck\Exception\UnexpectedArgumentException(0, $arguments[0]);
}
}

public function valid(array $arguments)
{
if (\count($arguments) > 0) {
throw new \Icecave\Collections\TypeCheck\Exception\UnexpectedArgumentException(0, $arguments[0]);
}
}

public function seek(array $arguments)
{
$argumentCount = \count($arguments);
if ($argumentCount < 1) {
throw new \Icecave\Collections\TypeCheck\Exception\MissingArgumentException('index', 0, 'integer');
} elseif ($argumentCount > 1) {
throw new \Icecave\Collections\TypeCheck\Exception\UnexpectedArgumentException(1, $arguments[1]);
}
$value = $arguments[0];
if (!\is_int($value)) {
throw new \Icecave\Collections\TypeCheck\Exception\UnexpectedArgumentValueException(
'index',
0,
$arguments[0],
'integer'
);
}
}

public function offsetExists(array $arguments)
{
$argumentCount = \count($arguments);
Expand Down
Loading

0 comments on commit c12f606

Please sign in to comment.