Merge pull request #233 from domnikl/iterator-bug

#232 removed Iterator classes
This commit is contained in:
Dominik Liebler
2016-09-22 18:01:14 +02:00
committed by GitHub
14 changed files with 575 additions and 389 deletions

View File

@@ -3,17 +3,10 @@ language: php
sudo: false sudo: false
php: php:
- 5.3
- 5.4
- 5.5
- 5.6
- 7.0 - 7.0
- hhvm - 7.1
matrix: matrix:
allow_failures:
- php: hhvm
- php: 7.0
fast_finish: true fast_finish: true
cache: cache:

View File

@@ -4,27 +4,33 @@ namespace DesignPatterns\Behavioral\Iterator;
class Book class Book
{ {
/**
* @var string
*/
private $author; private $author;
/**
* @var string
*/
private $title; private $title;
public function __construct($title, $author) public function __construct(string $title, string $author)
{ {
$this->author = $author; $this->author = $author;
$this->title = $title; $this->title = $title;
} }
public function getAuthor() public function getAuthor(): string
{ {
return $this->author; return $this->author;
} }
public function getTitle() public function getTitle(): string
{ {
return $this->title; return $this->title;
} }
public function getAuthorAndTitle() public function getAuthorAndTitle(): string
{ {
return $this->getTitle().' by '.$this->getAuthor(); return $this->getTitle().' by '.$this->getAuthor();
} }

View File

@@ -2,16 +2,17 @@
namespace DesignPatterns\Behavioral\Iterator; namespace DesignPatterns\Behavioral\Iterator;
class BookList implements \Countable class BookList implements \Countable, \Iterator
{ {
private $books; /**
* @var Book[]
*/
private $books = [];
public function getBook($bookNumberToGet) /**
{ * @var int
if (isset($this->books[$bookNumberToGet])) { */
return $this->books[$bookNumberToGet]; private $currentIndex = 0;
}
}
public function addBook(Book $book) public function addBook(Book $book)
{ {
@@ -21,15 +22,41 @@ class BookList implements \Countable
public function removeBook(Book $bookToRemove) public function removeBook(Book $bookToRemove)
{ {
foreach ($this->books as $key => $book) { foreach ($this->books as $key => $book) {
/** @var Book $book */
if ($book->getAuthorAndTitle() === $bookToRemove->getAuthorAndTitle()) { if ($book->getAuthorAndTitle() === $bookToRemove->getAuthorAndTitle()) {
unset($this->books[$key]); unset($this->books[$key]);
} }
} }
$this->books = array_values($this->books);
} }
public function count() public function count(): int
{ {
return count($this->books); return count($this->books);
} }
public function current(): Book
{
return $this->books[$this->currentIndex];
}
public function key(): int
{
return $this->currentIndex;
}
public function next()
{
$this->currentIndex++;
}
public function rewind()
{
$this->currentIndex = 0;
}
public function valid(): bool
{
return isset($this->books[$this->currentIndex]);
}
} }

View File

@@ -1,86 +0,0 @@
<?php
namespace DesignPatterns\Behavioral\Iterator;
class BookListIterator implements \Iterator
{
/**
* @var BookList
*/
private $bookList;
/**
* @var int
*/
protected $currentBook = 0;
public function __construct(BookList $bookList)
{
$this->bookList = $bookList;
}
/**
* Return the current book.
*
* @link http://php.net/manual/en/iterator.current.php
*
* @return Book Can return any type.
*/
public function current()
{
return $this->bookList->getBook($this->currentBook);
}
/**
* (PHP 5 &gt;= 5.0.0)<br/>
* Move forward to next element.
*
* @link http://php.net/manual/en/iterator.next.php
*
* @return void Any returned value is ignored.
*/
public function next()
{
$this->currentBook++;
}
/**
* (PHP 5 &gt;= 5.0.0)<br/>
* Return the key of the current element.
*
* @link http://php.net/manual/en/iterator.key.php
*
* @return mixed scalar on success, or null on failure.
*/
public function key()
{
return $this->currentBook;
}
/**
* (PHP 5 &gt;= 5.0.0)<br/>
* Checks if current position is valid.
*
* @link http://php.net/manual/en/iterator.valid.php
*
* @return bool The return value will be casted to boolean and then evaluated.
* Returns true on success or false on failure.
*/
public function valid()
{
return null !== $this->bookList->getBook($this->currentBook);
}
/**
* (PHP 5 &gt;= 5.0.0)<br/>
* Rewind the Iterator to the first element.
*
* @link http://php.net/manual/en/iterator.rewind.php
*
* @return void Any returned value is ignored.
*/
public function rewind()
{
$this->currentBook = 0;
}
}

View File

@@ -1,87 +0,0 @@
<?php
namespace DesignPatterns\Behavioral\Iterator;
class BookListReverseIterator implements \Iterator
{
/**
* @var BookList
*/
private $bookList;
/**
* @var int
*/
protected $currentBook = 0;
public function __construct(BookList $bookList)
{
$this->bookList = $bookList;
$this->currentBook = $this->bookList->count() - 1;
}
/**
* Return the current book.
*
* @link http://php.net/manual/en/iterator.current.php
*
* @return Book Can return any type.
*/
public function current()
{
return $this->bookList->getBook($this->currentBook);
}
/**
* (PHP 5 &gt;= 5.0.0)<br/>
* Move forward to next element.
*
* @link http://php.net/manual/en/iterator.next.php
*
* @return void Any returned value is ignored.
*/
public function next()
{
$this->currentBook--;
}
/**
* (PHP 5 &gt;= 5.0.0)<br/>
* Return the key of the current element.
*
* @link http://php.net/manual/en/iterator.key.php
*
* @return mixed scalar on success, or null on failure.
*/
public function key()
{
return $this->currentBook;
}
/**
* (PHP 5 &gt;= 5.0.0)<br/>
* Checks if current position is valid.
*
* @link http://php.net/manual/en/iterator.valid.php
*
* @return bool The return value will be casted to boolean and then evaluated.
* Returns true on success or false on failure.
*/
public function valid()
{
return null !== $this->bookList->getBook($this->currentBook);
}
/**
* (PHP 5 &gt;= 5.0.0)<br/>
* Rewind the Iterator to the first element.
*
* @link http://php.net/manual/en/iterator.rewind.php
*
* @return void Any returned value is ignored.
*/
public function rewind()
{
$this->currentBook = $this->bookList->count() - 1;
}
}

View File

@@ -4,8 +4,7 @@
Purpose Purpose
------- -------
To make an object iterable and to make it appear like a collection of To make an object iterable and to make it appear like a collection of objects.
objects.
Examples Examples
-------- --------
@@ -45,18 +44,6 @@ BookList.php
:language: php :language: php
:linenos: :linenos:
BookListIterator.php
.. literalinclude:: BookListIterator.php
:language: php
:linenos:
BookListReverseIterator.php
.. literalinclude:: BookListReverseIterator.php
:language: php
:linenos:
Test Test
---- ----
@@ -67,4 +54,4 @@ Tests/IteratorTest.php
:linenos: :linenos:
.. _`GitHub`: https://github.com/domnikl/DesignPatternsPHP/tree/master/Behavioral/Iterator .. _`GitHub`: https://github.com/domnikl/DesignPatternsPHP/tree/master/Behavioral/Iterator
.. __: http://en.wikipedia.org/wiki/Iterator_pattern .. __: http://en.wikipedia.org/wiki/Iterator_pattern

View File

@@ -9,66 +9,68 @@ use DesignPatterns\Behavioral\Iterator\BookListReverseIterator;
class IteratorTest extends \PHPUnit_Framework_TestCase class IteratorTest extends \PHPUnit_Framework_TestCase
{ {
/** public function testCanIterateOverBookList()
* @var BookList
*/
protected $bookList;
protected function setUp()
{ {
$this->bookList = new BookList(); $bookList = new BookList();
$this->bookList->addBook(new Book('Learning PHP Design Patterns', 'William Sanders')); $bookList->addBook(new Book('Learning PHP Design Patterns', 'William Sanders'));
$this->bookList->addBook(new Book('Professional Php Design Patterns', 'Aaron Saray')); $bookList->addBook(new Book('Professional Php Design Patterns', 'Aaron Saray'));
$this->bookList->addBook(new Book('Clean Code', 'Robert C. Martin')); $bookList->addBook(new Book('Clean Code', 'Robert C. Martin'));
}
public function expectedAuthors() $books = [];
{
return array( foreach ($bookList as $book) {
array( $books[] = $book->getAuthorAndTitle();
array( }
'Learning PHP Design Patterns by William Sanders',
'Professional Php Design Patterns by Aaron Saray', $this->assertEquals(
'Clean Code by Robert C. Martin', [
), 'Learning PHP Design Patterns by William Sanders',
), 'Professional Php Design Patterns by Aaron Saray',
'Clean Code by Robert C. Martin',
],
$books
); );
} }
/** public function testCanIterateOverBookListAfterRemovingBook()
* @dataProvider expectedAuthors
*/
public function testUseAIteratorAndValidateAuthors($expected)
{ {
$iterator = new BookListIterator($this->bookList); $book = new Book('Clean Code', 'Robert C. Martin');
$book2 = new Book('Professional Php Design Patterns', 'Aaron Saray');
while ($iterator->valid()) { $bookList = new BookList();
$expectedBook = array_shift($expected); $bookList->addBook($book);
$this->assertEquals($expectedBook, $iterator->current()->getAuthorAndTitle()); $bookList->addBook($book2);
$iterator->next(); $bookList->removeBook($book);
$books = [];
foreach ($bookList as $book) {
$books[] = $book->getAuthorAndTitle();
} }
$this->assertEquals(
['Professional Php Design Patterns by Aaron Saray'],
$books
);
} }
/** public function testCanAddBookToList()
* @dataProvider expectedAuthors
*/
public function testUseAReverseIteratorAndValidateAuthors($expected)
{ {
$iterator = new BookListReverseIterator($this->bookList); $book = new Book('Clean Code', 'Robert C. Martin');
while ($iterator->valid()) { $bookList = new BookList();
$expectedBook = array_pop($expected); $bookList->addBook($book);
$this->assertEquals($expectedBook, $iterator->current()->getAuthorAndTitle());
$iterator->next(); $this->assertCount(1, $bookList);
}
} }
/** public function testCanRemoveBookFromList()
* Test BookList Remove.
*/
public function testBookRemove()
{ {
$this->bookList->removeBook($this->bookList->getBook(0)); $book = new Book('Clean Code', 'Robert C. Martin');
$this->assertEquals($this->bookList->count(), 2);
$bookList = new BookList();
$bookList->addBook($book);
$bookList->removeBook($book);
$this->assertCount(0, $bookList);
} }
} }

View File

@@ -8,8 +8,11 @@
} }
], ],
"minimum-stability": "stable", "minimum-stability": "stable",
"require": {
"php": ">=7.0"
},
"require-dev": { "require-dev": {
"phpunit/phpunit": "^4.6", "phpunit/phpunit": ">=5.5.4",
"squizlabs/php_codesniffer": "1.5.*" "squizlabs/php_codesniffer": "1.5.*"
}, },
"autoload": { "autoload": {

577
composer.lock generated
View File

@@ -4,8 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"hash": "ccc9bc820717ca4dc310248ad4a69f21", "hash": "fc06bf31eb6cf4b21a7923e186abfb9d",
"content-hash": "f9ca7d34db86fa55e8dc649f84d8b4c7", "content-hash": "c829a84cbe749d776139a3e9ebdd3094",
"packages": [], "packages": [],
"packages-dev": [ "packages-dev": [
{ {
@@ -63,38 +63,129 @@
"time": "2015-06-14 21:17:01" "time": "2015-06-14 21:17:01"
}, },
{ {
"name": "phpdocumentor/reflection-docblock", "name": "myclabs/deep-copy",
"version": "2.0.4", "version": "1.5.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", "url": "https://github.com/myclabs/DeepCopy.git",
"reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8" "reference": "ea74994a3dc7f8d2f65a06009348f2d63c81e61f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d68dbdc53dc358a816f00b300704702b2eaff7b8", "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/ea74994a3dc7f8d2f65a06009348f2d63c81e61f",
"reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8", "reference": "ea74994a3dc7f8d2f65a06009348f2d63c81e61f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.3.3" "php": ">=5.4.0"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "~4.0" "doctrine/collections": "1.*",
"phpunit/phpunit": "~4.1"
}, },
"suggest": { "type": "library",
"dflydev/markdown": "~1.0", "autoload": {
"erusev/parsedown": "~1.0" "psr-4": {
"DeepCopy\\": "src/DeepCopy/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Create deep copies (clones) of your objects",
"homepage": "https://github.com/myclabs/DeepCopy",
"keywords": [
"clone",
"copy",
"duplicate",
"object",
"object graph"
],
"time": "2016-09-16 13:37:59"
},
{
"name": "phpdocumentor/reflection-common",
"version": "1.0",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionCommon.git",
"reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/144c307535e82c8fdcaacbcfc1d6d8eeb896687c",
"reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c",
"shasum": ""
},
"require": {
"php": ">=5.5"
},
"require-dev": {
"phpunit/phpunit": "^4.6"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "2.0.x-dev" "dev-master": "1.0.x-dev"
} }
}, },
"autoload": { "autoload": {
"psr-0": { "psr-4": {
"phpDocumentor": [ "phpDocumentor\\Reflection\\": [
"src"
]
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jaap van Otterdijk",
"email": "opensource@ijaap.nl"
}
],
"description": "Common reflection classes used by phpdocumentor to reflect the code structure",
"homepage": "http://www.phpdoc.org",
"keywords": [
"FQSEN",
"phpDocumentor",
"phpdoc",
"reflection",
"static analysis"
],
"time": "2015-12-27 11:43:31"
},
{
"name": "phpdocumentor/reflection-docblock",
"version": "3.1.0",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
"reference": "9270140b940ff02e58ec577c237274e92cd40cdd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/9270140b940ff02e58ec577c237274e92cd40cdd",
"reference": "9270140b940ff02e58ec577c237274e92cd40cdd",
"shasum": ""
},
"require": {
"php": ">=5.5",
"phpdocumentor/reflection-common": "^1.0@dev",
"phpdocumentor/type-resolver": "^0.2.0",
"webmozart/assert": "^1.0"
},
"require-dev": {
"mockery/mockery": "^0.9.4",
"phpunit/phpunit": "^4.4"
},
"type": "library",
"autoload": {
"psr-4": {
"phpDocumentor\\Reflection\\": [
"src/" "src/"
] ]
} }
@@ -106,37 +197,87 @@
"authors": [ "authors": [
{ {
"name": "Mike van Riel", "name": "Mike van Riel",
"email": "mike.vanriel@naenius.com" "email": "me@mikevanriel.com"
} }
], ],
"time": "2015-02-03 12:10:50" "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
"time": "2016-06-10 09:48:41"
}, },
{ {
"name": "phpspec/prophecy", "name": "phpdocumentor/type-resolver",
"version": "v1.5.0", "version": "0.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpspec/prophecy.git", "url": "https://github.com/phpDocumentor/TypeResolver.git",
"reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7" "reference": "b39c7a5b194f9ed7bd0dd345c751007a41862443"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/4745ded9307786b730d7a60df5cb5a6c43cf95f7", "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/b39c7a5b194f9ed7bd0dd345c751007a41862443",
"reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7", "reference": "b39c7a5b194f9ed7bd0dd345c751007a41862443",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"doctrine/instantiator": "^1.0.2", "php": ">=5.5",
"phpdocumentor/reflection-docblock": "~2.0", "phpdocumentor/reflection-common": "^1.0"
"sebastian/comparator": "~1.1"
}, },
"require-dev": { "require-dev": {
"phpspec/phpspec": "~2.0" "mockery/mockery": "^0.9.4",
"phpunit/phpunit": "^5.2||^4.8.24"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.4.x-dev" "dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"phpDocumentor\\Reflection\\": [
"src/"
]
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mike van Riel",
"email": "me@mikevanriel.com"
}
],
"time": "2016-06-10 07:14:17"
},
{
"name": "phpspec/prophecy",
"version": "v1.6.1",
"source": {
"type": "git",
"url": "https://github.com/phpspec/prophecy.git",
"reference": "58a8137754bc24b25740d4281399a4a3596058e0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/58a8137754bc24b25740d4281399a4a3596058e0",
"reference": "58a8137754bc24b25740d4281399a4a3596058e0",
"shasum": ""
},
"require": {
"doctrine/instantiator": "^1.0.2",
"php": "^5.3|^7.0",
"phpdocumentor/reflection-docblock": "^2.0|^3.0.2",
"sebastian/comparator": "^1.1",
"sebastian/recursion-context": "^1.0"
},
"require-dev": {
"phpspec/phpspec": "^2.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.6.x-dev"
} }
}, },
"autoload": { "autoload": {
@@ -169,43 +310,44 @@
"spy", "spy",
"stub" "stub"
], ],
"time": "2015-08-13 10:07:40" "time": "2016-06-07 08:13:47"
}, },
{ {
"name": "phpunit/php-code-coverage", "name": "phpunit/php-code-coverage",
"version": "2.2.4", "version": "4.0.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979" "reference": "5f3f7e736d6319d5f1fc402aff8b026da26709a3"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979", "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/5f3f7e736d6319d5f1fc402aff8b026da26709a3",
"reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979", "reference": "5f3f7e736d6319d5f1fc402aff8b026da26709a3",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.3.3", "php": "^5.6 || ^7.0",
"phpunit/php-file-iterator": "~1.3", "phpunit/php-file-iterator": "~1.3",
"phpunit/php-text-template": "~1.2", "phpunit/php-text-template": "~1.2",
"phpunit/php-token-stream": "~1.3", "phpunit/php-token-stream": "^1.4.2",
"sebastian/environment": "^1.3.2", "sebastian/code-unit-reverse-lookup": "~1.0",
"sebastian/version": "~1.0" "sebastian/environment": "^1.3.2 || ^2.0",
"sebastian/version": "~1.0|~2.0"
}, },
"require-dev": { "require-dev": {
"ext-xdebug": ">=2.1.4", "ext-xdebug": ">=2.1.4",
"phpunit/phpunit": "~4" "phpunit/phpunit": "^5.4"
}, },
"suggest": { "suggest": {
"ext-dom": "*", "ext-dom": "*",
"ext-xdebug": ">=2.2.1", "ext-xdebug": ">=2.4.0",
"ext-xmlwriter": "*" "ext-xmlwriter": "*"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "2.2.x-dev" "dev-master": "4.0.x-dev"
} }
}, },
"autoload": { "autoload": {
@@ -231,7 +373,7 @@
"testing", "testing",
"xunit" "xunit"
], ],
"time": "2015-10-06 15:47:00" "time": "2016-07-26 14:39:29"
}, },
{ {
"name": "phpunit/php-file-iterator", "name": "phpunit/php-file-iterator",
@@ -323,21 +465,24 @@
}, },
{ {
"name": "phpunit/php-timer", "name": "phpunit/php-timer",
"version": "1.0.7", "version": "1.0.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/php-timer.git", "url": "https://github.com/sebastianbergmann/php-timer.git",
"reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b" "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3e82f4e9fc92665fafd9157568e4dcb01d014e5b", "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/38e9124049cf1a164f1e4537caf19c99bf1eb260",
"reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b", "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.3.3" "php": ">=5.3.3"
}, },
"require-dev": {
"phpunit/phpunit": "~4|~5"
},
"type": "library", "type": "library",
"autoload": { "autoload": {
"classmap": [ "classmap": [
@@ -360,7 +505,7 @@
"keywords": [ "keywords": [
"timer" "timer"
], ],
"time": "2015-06-21 08:01:12" "time": "2016-05-12 18:03:57"
}, },
{ {
"name": "phpunit/php-token-stream", "name": "phpunit/php-token-stream",
@@ -413,16 +558,16 @@
}, },
{ {
"name": "phpunit/phpunit", "name": "phpunit/phpunit",
"version": "4.8.18", "version": "5.5.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git", "url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "fa33d4ad96481b91df343d83e8c8aabed6b1dfd3" "reference": "3e6e88e56c912133de6e99b87728cca7ed70c5f5"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/fa33d4ad96481b91df343d83e8c8aabed6b1dfd3", "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3e6e88e56c912133de6e99b87728cca7ed70c5f5",
"reference": "fa33d4ad96481b91df343d83e8c8aabed6b1dfd3", "reference": "3e6e88e56c912133de6e99b87728cca7ed70c5f5",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -431,21 +576,27 @@
"ext-pcre": "*", "ext-pcre": "*",
"ext-reflection": "*", "ext-reflection": "*",
"ext-spl": "*", "ext-spl": "*",
"php": ">=5.3.3", "myclabs/deep-copy": "~1.3",
"php": "^5.6 || ^7.0",
"phpspec/prophecy": "^1.3.1", "phpspec/prophecy": "^1.3.1",
"phpunit/php-code-coverage": "~2.1", "phpunit/php-code-coverage": "^4.0.1",
"phpunit/php-file-iterator": "~1.4", "phpunit/php-file-iterator": "~1.4",
"phpunit/php-text-template": "~1.2", "phpunit/php-text-template": "~1.2",
"phpunit/php-timer": ">=1.0.6", "phpunit/php-timer": "^1.0.6",
"phpunit/phpunit-mock-objects": "~2.3", "phpunit/phpunit-mock-objects": "^3.2",
"sebastian/comparator": "~1.1", "sebastian/comparator": "~1.1",
"sebastian/diff": "~1.2", "sebastian/diff": "~1.2",
"sebastian/environment": "~1.3", "sebastian/environment": "^1.3 || ^2.0",
"sebastian/exporter": "~1.2", "sebastian/exporter": "~1.2",
"sebastian/global-state": "~1.0", "sebastian/global-state": "~1.0",
"sebastian/version": "~1.0", "sebastian/object-enumerator": "~1.0",
"sebastian/resource-operations": "~1.0",
"sebastian/version": "~1.0|~2.0",
"symfony/yaml": "~2.1|~3.0" "symfony/yaml": "~2.1|~3.0"
}, },
"conflict": {
"phpdocumentor/reflection-docblock": "3.0.2"
},
"suggest": { "suggest": {
"phpunit/php-invoker": "~1.1" "phpunit/php-invoker": "~1.1"
}, },
@@ -455,7 +606,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "4.8.x-dev" "dev-master": "5.5.x-dev"
} }
}, },
"autoload": { "autoload": {
@@ -481,30 +632,33 @@
"testing", "testing",
"xunit" "xunit"
], ],
"time": "2015-11-11 11:32:49" "time": "2016-08-26 07:11:44"
}, },
{ {
"name": "phpunit/phpunit-mock-objects", "name": "phpunit/phpunit-mock-objects",
"version": "2.3.8", "version": "3.2.7",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
"reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983" "reference": "546898a2c0c356ef2891b39dd7d07f5d82c8ed0a"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983", "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/546898a2c0c356ef2891b39dd7d07f5d82c8ed0a",
"reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983", "reference": "546898a2c0c356ef2891b39dd7d07f5d82c8ed0a",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"doctrine/instantiator": "^1.0.2", "doctrine/instantiator": "^1.0.2",
"php": ">=5.3.3", "php": "^5.6 || ^7.0",
"phpunit/php-text-template": "~1.2", "phpunit/php-text-template": "^1.2",
"sebastian/exporter": "~1.2" "sebastian/exporter": "^1.2"
},
"conflict": {
"phpunit/phpunit": "<5.4.0"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "~4.4" "phpunit/phpunit": "^5.4"
}, },
"suggest": { "suggest": {
"ext-soap": "*" "ext-soap": "*"
@@ -512,7 +666,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "2.3.x-dev" "dev-master": "3.2.x-dev"
} }
}, },
"autoload": { "autoload": {
@@ -537,7 +691,52 @@
"mock", "mock",
"xunit" "xunit"
], ],
"time": "2015-10-02 06:51:40" "time": "2016-09-06 16:07:45"
},
{
"name": "sebastian/code-unit-reverse-lookup",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git",
"reference": "c36f5e7cfce482fde5bf8d10d41a53591e0198fe"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/c36f5e7cfce482fde5bf8d10d41a53591e0198fe",
"reference": "c36f5e7cfce482fde5bf8d10d41a53591e0198fe",
"shasum": ""
},
"require": {
"php": ">=5.6"
},
"require-dev": {
"phpunit/phpunit": "~5"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Looks up which function or method a line of code belongs to",
"homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/",
"time": "2016-02-13 06:45:14"
}, },
{ {
"name": "sebastian/comparator", "name": "sebastian/comparator",
@@ -605,28 +804,28 @@
}, },
{ {
"name": "sebastian/diff", "name": "sebastian/diff",
"version": "1.3.0", "version": "1.4.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/diff.git", "url": "https://github.com/sebastianbergmann/diff.git",
"reference": "863df9687835c62aa423a22412d26fa2ebde3fd3" "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/863df9687835c62aa423a22412d26fa2ebde3fd3", "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e",
"reference": "863df9687835c62aa423a22412d26fa2ebde3fd3", "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.3.3" "php": ">=5.3.3"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "~4.2" "phpunit/phpunit": "~4.8"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.3-dev" "dev-master": "1.4-dev"
} }
}, },
"autoload": { "autoload": {
@@ -649,31 +848,31 @@
} }
], ],
"description": "Diff implementation", "description": "Diff implementation",
"homepage": "http://www.github.com/sebastianbergmann/diff", "homepage": "https://github.com/sebastianbergmann/diff",
"keywords": [ "keywords": [
"diff" "diff"
], ],
"time": "2015-02-22 15:13:53" "time": "2015-12-08 07:14:41"
}, },
{ {
"name": "sebastian/environment", "name": "sebastian/environment",
"version": "1.3.2", "version": "1.3.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/environment.git", "url": "https://github.com/sebastianbergmann/environment.git",
"reference": "6324c907ce7a52478eeeaede764f48733ef5ae44" "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6324c907ce7a52478eeeaede764f48733ef5ae44", "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/be2c607e43ce4c89ecd60e75c6a85c126e754aea",
"reference": "6324c907ce7a52478eeeaede764f48733ef5ae44", "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.3.3" "php": "^5.3.3 || ^7.0"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "~4.4" "phpunit/phpunit": "^4.8 || ^5.0"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
@@ -703,20 +902,20 @@
"environment", "environment",
"hhvm" "hhvm"
], ],
"time": "2015-08-03 06:14:51" "time": "2016-08-18 05:49:44"
}, },
{ {
"name": "sebastian/exporter", "name": "sebastian/exporter",
"version": "1.2.1", "version": "1.2.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/exporter.git", "url": "https://github.com/sebastianbergmann/exporter.git",
"reference": "7ae5513327cb536431847bcc0c10edba2701064e" "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/7ae5513327cb536431847bcc0c10edba2701064e", "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/42c4c2eec485ee3e159ec9884f95b431287edde4",
"reference": "7ae5513327cb536431847bcc0c10edba2701064e", "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -724,12 +923,13 @@
"sebastian/recursion-context": "~1.0" "sebastian/recursion-context": "~1.0"
}, },
"require-dev": { "require-dev": {
"ext-mbstring": "*",
"phpunit/phpunit": "~4.4" "phpunit/phpunit": "~4.4"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.2.x-dev" "dev-master": "1.3.x-dev"
} }
}, },
"autoload": { "autoload": {
@@ -769,7 +969,7 @@
"export", "export",
"exporter" "exporter"
], ],
"time": "2015-06-21 07:55:53" "time": "2016-06-17 09:04:28"
}, },
{ {
"name": "sebastian/global-state", "name": "sebastian/global-state",
@@ -823,17 +1023,63 @@
"time": "2015-10-12 03:26:01" "time": "2015-10-12 03:26:01"
}, },
{ {
"name": "sebastian/recursion-context", "name": "sebastian/object-enumerator",
"version": "1.0.1", "version": "1.0.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/recursion-context.git", "url": "https://github.com/sebastianbergmann/object-enumerator.git",
"reference": "994d4a811bafe801fb06dccbee797863ba2792ba" "reference": "d4ca2fb70344987502567bc50081c03e6192fb26"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/994d4a811bafe801fb06dccbee797863ba2792ba", "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/d4ca2fb70344987502567bc50081c03e6192fb26",
"reference": "994d4a811bafe801fb06dccbee797863ba2792ba", "reference": "d4ca2fb70344987502567bc50081c03e6192fb26",
"shasum": ""
},
"require": {
"php": ">=5.6",
"sebastian/recursion-context": "~1.0"
},
"require-dev": {
"phpunit/phpunit": "~5"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Traverses array structures and object graphs to enumerate all referenced objects",
"homepage": "https://github.com/sebastianbergmann/object-enumerator/",
"time": "2016-01-28 13:25:10"
},
{
"name": "sebastian/recursion-context",
"version": "1.0.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/recursion-context.git",
"reference": "913401df809e99e4f47b27cdd781f4a258d58791"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/913401df809e99e4f47b27cdd781f4a258d58791",
"reference": "913401df809e99e4f47b27cdd781f4a258d58791",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -873,23 +1119,73 @@
], ],
"description": "Provides functionality to recursively process PHP variables", "description": "Provides functionality to recursively process PHP variables",
"homepage": "http://www.github.com/sebastianbergmann/recursion-context", "homepage": "http://www.github.com/sebastianbergmann/recursion-context",
"time": "2015-06-21 08:04:50" "time": "2015-11-11 19:50:13"
}, },
{ {
"name": "sebastian/version", "name": "sebastian/resource-operations",
"version": "1.0.6", "version": "1.0.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/version.git", "url": "https://github.com/sebastianbergmann/resource-operations.git",
"reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52",
"reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52",
"shasum": "" "shasum": ""
}, },
"require": {
"php": ">=5.6.0"
},
"type": "library", "type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Provides a list of PHP built-in functions that operate on resources",
"homepage": "https://www.github.com/sebastianbergmann/resource-operations",
"time": "2015-07-28 20:34:47"
},
{
"name": "sebastian/version",
"version": "2.0.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/version.git",
"reference": "c829badbd8fdf16a0bad8aa7fa7971c029f1b9c5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c829badbd8fdf16a0bad8aa7fa7971c029f1b9c5",
"reference": "c829badbd8fdf16a0bad8aa7fa7971c029f1b9c5",
"shasum": ""
},
"require": {
"php": ">=5.6"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"autoload": { "autoload": {
"classmap": [ "classmap": [
"src/" "src/"
@@ -908,7 +1204,7 @@
], ],
"description": "Library that helps with managing the version number of Git-hosted PHP projects", "description": "Library that helps with managing the version number of Git-hosted PHP projects",
"homepage": "https://github.com/sebastianbergmann/version", "homepage": "https://github.com/sebastianbergmann/version",
"time": "2015-06-21 13:59:46" "time": "2016-02-04 12:56:52"
}, },
{ {
"name": "squizlabs/php_codesniffer", "name": "squizlabs/php_codesniffer",
@@ -987,31 +1283,34 @@
}, },
{ {
"name": "symfony/yaml", "name": "symfony/yaml",
"version": "v2.7.6", "version": "v3.1.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/yaml.git", "url": "https://github.com/symfony/yaml.git",
"reference": "eca9019c88fbe250164affd107bc8057771f3f4d" "reference": "f291ed25eb1435bddbe8a96caaef16469c2a092d"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/eca9019c88fbe250164affd107bc8057771f3f4d", "url": "https://api.github.com/repos/symfony/yaml/zipball/f291ed25eb1435bddbe8a96caaef16469c2a092d",
"reference": "eca9019c88fbe250164affd107bc8057771f3f4d", "reference": "f291ed25eb1435bddbe8a96caaef16469c2a092d",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.3.9" "php": ">=5.5.9"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "2.7-dev" "dev-master": "3.1-dev"
} }
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"Symfony\\Component\\Yaml\\": "" "Symfony\\Component\\Yaml\\": ""
} },
"exclude-from-classmap": [
"/Tests/"
]
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
@@ -1029,7 +1328,57 @@
], ],
"description": "Symfony Yaml Component", "description": "Symfony Yaml Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2015-10-11 09:39:48" "time": "2016-09-02 02:12:52"
},
{
"name": "webmozart/assert",
"version": "1.1.0",
"source": {
"type": "git",
"url": "https://github.com/webmozart/assert.git",
"reference": "bb2d123231c095735130cc8f6d31385a44c7b308"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/webmozart/assert/zipball/bb2d123231c095735130cc8f6d31385a44c7b308",
"reference": "bb2d123231c095735130cc8f6d31385a44c7b308",
"shasum": ""
},
"require": {
"php": "^5.3.3|^7.0"
},
"require-dev": {
"phpunit/phpunit": "^4.6",
"sebastian/version": "^1.0.1"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.2-dev"
}
},
"autoload": {
"psr-4": {
"Webmozart\\Assert\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Bernhard Schussek",
"email": "bschussek@gmail.com"
}
],
"description": "Assertions to validate method input/output with nice error messages.",
"keywords": [
"assert",
"check",
"validate"
],
"time": "2016-08-09 15:02:57"
} }
], ],
"aliases": [], "aliases": [],
@@ -1037,6 +1386,8 @@
"stability-flags": [], "stability-flags": [],
"prefer-stable": false, "prefer-stable": false,
"prefer-lowest": false, "prefer-lowest": false,
"platform": [], "platform": {
"php": ">=7.0"
},
"platform-dev": [] "platform-dev": []
} }

View File

@@ -1,4 +1,4 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: DesignPatternsPHP 1.0\n" "Project-Id-Version: DesignPatternsPHP 1.0\n"
@@ -20,9 +20,7 @@ msgid "Purpose"
msgstr "" msgstr ""
#: ../../Behavioral/Iterator/README.rst:7 #: ../../Behavioral/Iterator/README.rst:7
msgid "" msgid "To make an object iterable and to make it appear like a collection of objects."
"To make an object iterable and to make it appear like a collection of "
"objects."
msgstr "" msgstr ""
#: ../../Behavioral/Iterator/README.rst:11 #: ../../Behavioral/Iterator/README.rst:11

View File

@@ -1,4 +1,4 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: DesignPatternsPHP 1.0\n" "Project-Id-Version: DesignPatternsPHP 1.0\n"
@@ -20,9 +20,7 @@ msgid "Purpose"
msgstr "" msgstr ""
#: ../../Behavioral/Iterator/README.rst:7 #: ../../Behavioral/Iterator/README.rst:7
msgid "" msgid "To make an object iterable and to make it appear like a collection of objects."
"To make an object iterable and to make it appear like a collection of "
"objects."
msgstr "" msgstr ""
#: ../../Behavioral/Iterator/README.rst:11 #: ../../Behavioral/Iterator/README.rst:11

View File

@@ -1,4 +1,4 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: DesignPatternsPHP 1.0\n" "Project-Id-Version: DesignPatternsPHP 1.0\n"
@@ -20,9 +20,7 @@ msgid "Purpose"
msgstr "" msgstr ""
#: ../../Behavioral/Iterator/README.rst:7 #: ../../Behavioral/Iterator/README.rst:7
msgid "" msgid To make an object iterable and to make it appear like a collection of objects."
"To make an object iterable and to make it appear like a collection of "
"objects."
msgstr "" msgstr ""
#: ../../Behavioral/Iterator/README.rst:11 #: ../../Behavioral/Iterator/README.rst:11

View File

@@ -20,9 +20,7 @@ msgid "Purpose"
msgstr "Назначение" msgstr "Назначение"
#: ../../Behavioral/Iterator/README.rst:7 #: ../../Behavioral/Iterator/README.rst:7
msgid "" msgid "To make an object iterable and to make it appear like a collection of objects."
"To make an object iterable and to make it appear like a collection of "
"objects."
msgstr "" msgstr ""
"Добавить коллекции объектов функционал последовательного доступа к " "Добавить коллекции объектов функционал последовательного доступа к "
"содержащимся в ней экземплярам объектов без реализации этого функционала в " "содержащимся в ней экземплярам объектов без реализации этого функционала в "

View File

@@ -1,4 +1,4 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: DesignPatternsPHP 1.0\n" "Project-Id-Version: DesignPatternsPHP 1.0\n"
@@ -20,9 +20,7 @@ msgid "Purpose"
msgstr "" msgstr ""
#: ../../Behavioral/Iterator/README.rst:7 #: ../../Behavioral/Iterator/README.rst:7
msgid "" msgid To make an object iterable and to make it appear like a collection of objects."
"To make an object iterable and to make it appear like a collection of "
"objects."
msgstr "" msgstr ""
#: ../../Behavioral/Iterator/README.rst:11 #: ../../Behavioral/Iterator/README.rst:11