Skip to content
Open
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
2 changes: 2 additions & 0 deletions sources.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
SOURCES = \
src/AbstractSet.php \
src/Attribute/Filterable.php
src/Attribute/Mappable.php
src/AvlTree.php \
src/BinarySearchTree.php \
src/BinaryTree.php \
Expand Down
14 changes: 14 additions & 0 deletions src/Attribute/Filterable.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace Collections\Attribute;

interface Filterable {

/**
* @param callable $filter
* @return \Traversable
*/
function filter(callable $filter);

}

14 changes: 14 additions & 0 deletions src/Attribute/Mappable.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace Collections\Attribute;

interface Mappable {

/**
* @param callable $mapper
* @return \Traversable
*/
function map(callable $mapper);

}

6 changes: 5 additions & 1 deletion src/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

namespace Collections;

interface Collection extends \Traversable {
use Collections\Attribute\Filterable;
use Collections\Attribute\Mappable;


interface Collection extends \Traversable, Filterable, Mappable {

/**
* @return bool
Expand Down
2 changes: 2 additions & 0 deletions src/function.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ function autoload($className) {
static $classMap = [
'Collections\\AbstractSet' => 'AbstractSet.php',
'Collections\\ArrayIterator' => 'Iterator/ArrayIterator.php',
'Collections\\Attribute\\Filterable' => 'Attribute/Filterable.php',
'Collections\\Attribute\\Mappable' => 'Attribute/Mappable.php',
'Collections\\AvlTree' => 'AvlTree.php',
'Collections\\BinarySearchTree' => 'BinarySearchTree.php',
'Collections\\BinaryTree' => 'BinaryTree.php',
Expand Down