diff --git a/.travis.install b/.travis.install index 63eb428..47961e7 100755 --- a/.travis.install +++ b/.travis.install @@ -1,10 +1,14 @@ #!/usr/bin/env php array( 'notify-on-install' => false @@ -16,20 +20,23 @@ if ($token = getenv('ARCHER_TOKEN')) { 'github.com' => $token ); $composerFlags = '--prefer-dist'; - passthru('curl -s -i -H "Authorization: token $ARCHER_TOKEN" https://api.github.com | grep "^X-RateLimit"'); } else { $composerFlags = '--prefer-source'; } $file = '~/.composer/config.json'; -$dir = dirname($file); +$dir = dirname($file); if (!is_dir($dir)) { mkdir($dir, 0755, true); } file_put_contents($file, json_encode($config)); -passthru('composer self-update --no-interaction'); +// Display some information about GitHub rate limiting ... +if ($token) { + passthru('curl -s -i -H "Authorization: token $ARCHER_TOKEN" https://api.github.com | grep "^X-RateLimit"'); +} +// Install composer dependencies ... $exitCode = 0; passthru('composer install --dev --no-progress --no-interaction --ansi ' . $composerFlags, $exitCode); exit($exitCode); diff --git a/.travis.yml b/.travis.yml index ef118b3..0bb3442 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,21 +1,14 @@ -# -# This is the default Travis CI configuration. -# -# It uses a GitHub OAuth token when fetching composer dependencies -# to avoid IP-based API throttling. -# -# It also allows publication of artifacts via an additional build. -# language: php php: ["5.3", "5.4", "5.5"] env: global: - - ARCHER_PUBLISH_VERSION=5.4 + - ARCHER_PUBLISH_VERSION=5.5 - secure: "UKSpkbbxP62R8wUFrkWM6u8fmkzS85OugzaMWrx1qZTCEQ3AqdxtfLUg6SmE7ALjRQZS/CUPUZmTM05b1CsozLtk/Ehq86fNz12lWzVadfOq4J1ot9YsR5pFHb3PMusQdYZwEOppb/CAa4/FTR/K8mels4/cLclkem+kCogFTTQ=" install: - ./.travis.install + script: - ./vendor/bin/archer travis:build diff --git a/CHANGELOG.md b/CHANGELOG.md index 7eef055..89f1e7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Temptation Changelog +### 1.0.0 (2014-09-09) + +* **[FIXED]** Fixed race condition when creating temporary directory +* **[IMPROVED]** Updated autoloader to [PSR-4](http://www.php-fig.org/psr/psr-4/) + ### 0.1.0 (2013-10-02) -* Initial relase +* Initial release diff --git a/LICENSE.md b/LICENSE.md index 9dace16..3357568 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ # License -**© 2013, [James Harris](https://github.com/jmalloc)** +**© 2013-2014, [James Harris](https://github.com/jmalloc)** Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/README.md b/README.md index 1e3e28d..1d3482f 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![Test Coverage]](https://coveralls.io/r/IcecaveStudios/temptation?branch=develop) [![SemVer]](http://semver.org) -**Temptation** is a simple PHP library for creating temporary files and directories that cleanup after themselves. +**Temptation** is a simple PHP library for creating temporary files and directories that clean up after themselves. * Install via [Composer](http://getcomposer.org) package [icecave/temptation](https://packagist.org/packages/icecave/temptation) * Read the [API documentation](http://icecavestudios.github.io/temptation/artifacts/documentation/api/) @@ -12,7 +12,6 @@ ## Example ```php -path(), 'This is my temp file.'); ``` -[Build Status]: https://travis-ci.org/IcecaveStudios/temptation.png?branch=develop -[Test Coverage]: https://coveralls.io/repos/IcecaveStudios/temptation/badge.png?branch=develop -[SemVer]: http://calm-shore-6115.herokuapp.com/?label=semver&value=0.1.0&color=yellow +[Build Status]: http://img.shields.io/travis/IcecaveStudios/temptation/develop.svg +[Test Coverage]: http://img.shields.io/coveralls/IcecaveStudios/temptation/develop.svg +[SemVer]: http://img.shields.io/:semver-1.0.0-green.svg diff --git a/composer.json b/composer.json index c906cd0..2de5227 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,14 @@ { "name": "icecave/temptation", - "description": "Painless temporary files and directories that cleanup after themselves.", - "keywords": ["tmp", "temp", "folder", "dir", "directory", "file"], + "description": "Painless temporary files and directories that clean up after themselves.", + "keywords": [ + "tmp", + "temp", + "folder", + "dir", + "directory", + "file" + ], "homepage": "https://github.com/IcecaveStudios/temptation", "license": "MIT", "authors": [ @@ -17,20 +24,16 @@ "icecave/isolator": "~2" }, "require-dev": { - "eloquent/typhoon": "~0.9.0", "icecave/archer": "~1" }, "autoload": { - "psr-0": { - "Icecave\\Temptation": "src", - "Icecave\\Temptation\\TypeCheck": "src-typhoon" + "psr-4": { + "Icecave\\Temptation\\": "src" } }, "extra": { - "typhoon": { - "output-path": "src-typhoon", - "validator-namespace": "Icecave\\Temptation\\TypeCheck", - "use-native-callable": false + "branch-alias": { + "dev-develop": "1.0.x-dev" } } } diff --git a/composer.lock b/composer.lock index 556b0aa..5f9285e 100644 --- a/composer.lock +++ b/composer.lock @@ -1,34 +1,38 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file" + "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" ], - "hash": "398c588172bc553176cc8258f8a6935b", + "hash": "72779cc88281aa3816cf726ad3e385c1", "packages": [ { "name": "icecave/isolator", - "version": "2.2.0", + "version": "2.3.0", "source": { "type": "git", "url": "https://github.com/IcecaveStudios/isolator.git", - "reference": "2f3fbfcee90790fb3ddde9d4288a2a927cdf6dd6" + "reference": "97c51fafa39c57a8f1a31f978a48fbe6cea4a5d5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/IcecaveStudios/isolator/zipball/2f3fbfcee90790fb3ddde9d4288a2a927cdf6dd6", - "reference": "2f3fbfcee90790fb3ddde9d4288a2a927cdf6dd6", + "url": "https://api.github.com/repos/IcecaveStudios/isolator/zipball/97c51fafa39c57a8f1a31f978a48fbe6cea4a5d5", + "reference": "97c51fafa39c57a8f1a31f978a48fbe6cea4a5d5", "shasum": "" }, "require": { "php": ">=5.3" }, "require-dev": { - "icecave/archer": "~0.4" + "icecave/archer": "~1" + }, + "suggest": { + "eloquent/asplode": "Drop-in exception-based error handling." }, "type": "library", "autoload": { - "psr-0": { - "Icecave\\Isolator": "lib" + "psr-4": { + "Icecave\\Isolator\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -42,7 +46,7 @@ "homepage": "https://github.com/jmalloc" } ], - "description": "Isolate PHP tests from the global environment.", + "description": "Dependency injection for global functions.", "homepage": "https://github.com/IcecaveStudios/isolator", "keywords": [ "fake", @@ -52,21 +56,21 @@ "test", "unit" ], - "time": "2013-06-04 05:00:29" + "time": "2014-08-12 03:16:11" }, { "name": "symfony/filesystem", - "version": "v2.3.5", + "version": "v2.5.4", "target-dir": "Symfony/Component/Filesystem", "source": { "type": "git", "url": "https://github.com/symfony/Filesystem.git", - "reference": "2b8995042086c5552c94d33b5553c492e9cfc00e" + "reference": "a765efd199e02ff4001c115c318e219030be9364" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Filesystem/zipball/2b8995042086c5552c94d33b5553c492e9cfc00e", - "reference": "2b8995042086c5552c94d33b5553c492e9cfc00e", + "url": "https://api.github.com/repos/symfony/Filesystem/zipball/a765efd199e02ff4001c115c318e219030be9364", + "reference": "a765efd199e02ff4001c115c318e219030be9364", "shasum": "" }, "require": { @@ -75,7 +79,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev" + "dev-master": "2.5-dev" } }, "autoload": { @@ -88,18 +92,18 @@ "MIT" ], "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, { "name": "Symfony Community", "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" } ], "description": "Symfony Filesystem Component", "homepage": "http://symfony.com", - "time": "2013-09-19 09:45:20" + "time": "2014-09-03 09:00:14" } ], "packages-dev": [ @@ -162,390 +166,24 @@ ], "time": "2013-09-23 12:00:18" }, - { - "name": "eloquent/asplode", - "version": "1.1.1", - "source": { - "type": "git", - "url": "https://github.com/eloquent/asplode.git", - "reference": "34591a5919625bc49f86ac4b7a473593c2b8e95e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/eloquent/asplode/zipball/34591a5919625bc49f86ac4b7a473593c2b8e95e", - "reference": "34591a5919625bc49f86ac4b7a473593c2b8e95e", - "shasum": "" - }, - "require": { - "icecave/isolator": "~2", - "php": ">=5.3.0" - }, - "require-dev": { - "icecave/archer": "1.0.0-alpha.2" - }, - "type": "library", - "autoload": { - "psr-0": { - "Eloquent\\Asplode": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Erin Millard", - "email": "ezzatron@gmail.com", - "homepage": "http://ezzatron.com/" - } - ], - "description": "Drop-in exception-based error handling for PHP.", - "homepage": "https://github.com/eloquent/asplode", - "keywords": [ - "error", - "errorexception", - "exception", - "failure", - "fault", - "handler", - "handling" - ], - "time": "2013-08-01 10:46:05" - }, - { - "name": "eloquent/blox", - "version": "1.2.0", - "source": { - "type": "git", - "url": "https://github.com/eloquent/blox.git", - "reference": "d3e51e6fc6fb1e722f17418eeb19ba674b267cf1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/eloquent/blox/zipball/d3e51e6fc6fb1e722f17418eeb19ba674b267cf1", - "reference": "d3e51e6fc6fb1e722f17418eeb19ba674b267cf1", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "require-dev": { - "phake/phake": "1.*" - }, - "type": "library", - "autoload": { - "psr-0": { - "Eloquent\\Blox": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Erin Millard", - "email": "ezzatron@gmail.com", - "homepage": "http://ezzatron.com/" - } - ], - "description": "A parser for block comment documentation.", - "homepage": "https://github.com/eloquent/blox", - "keywords": [ - "annotation", - "block", - "comment", - "docblock", - "documentation", - "parser", - "phpDocumentor", - "phpdoc", - "tag" - ], - "time": "2012-08-05 06:40:35" - }, - { - "name": "eloquent/cosmos", - "version": "2.3.1", - "source": { - "type": "git", - "url": "https://github.com/eloquent/cosmos.git", - "reference": "0226b7aa39c629cdbb41bde759adff59d932d16d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/eloquent/cosmos/zipball/0226b7aa39c629cdbb41bde759adff59d932d16d", - "reference": "0226b7aa39c629cdbb41bde759adff59d932d16d", - "shasum": "" - }, - "require": { - "eloquent/equality": "~2", - "icecave/isolator": "~2", - "php": ">=5.3.0" - }, - "require-dev": { - "icecave/archer": "~0.2" - }, - "type": "library", - "autoload": { - "psr-0": { - "Eloquent\\Cosmos": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Erin Millard", - "email": "ezzatron@gmail.com", - "homepage": "http://ezzatron.com/" - } - ], - "description": "A library for representing and manipulating PHP class names.", - "homepage": "https://github.com/eloquent/cosmos", - "keywords": [ - "class", - "classname", - "name", - "namespace", - "php", - "resolver", - "solver" - ], - "time": "2013-03-04 09:26:13" - }, - { - "name": "eloquent/enumeration", - "version": "3.0.2", - "source": { - "type": "git", - "url": "https://github.com/eloquent/enumeration.git", - "reference": "ee87a3062d71a00cb61167f2d59dd479a129caf6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/eloquent/enumeration/zipball/ee87a3062d71a00cb61167f2d59dd479a129caf6", - "reference": "ee87a3062d71a00cb61167f2d59dd479a129caf6", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "require-dev": { - "icecave/archer": "~0.2" - }, - "type": "library", - "autoload": { - "psr-0": { - "Eloquent\\Enumeration": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Erin Millard", - "email": "ezzatron@gmail.com", - "homepage": "http://ezzatron.com/" - } - ], - "description": "An enumeration implementation for PHP.", - "homepage": "https://github.com/eloquent/enumeration", - "keywords": [ - "class", - "enum", - "enumeration", - "set" - ], - "time": "2013-03-04 09:52:52" - }, - { - "name": "eloquent/equality", - "version": "2.1.1", - "source": { - "type": "git", - "url": "https://github.com/eloquent/equality.git", - "reference": "83ee596b89786d320470e0ac825df8d0e20d906f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/eloquent/equality/zipball/83ee596b89786d320470e0ac825df8d0e20d906f", - "reference": "83ee596b89786d320470e0ac825df8d0e20d906f", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "require-dev": { - "icecave/archer": "~0.2" - }, - "type": "library", - "autoload": { - "psr-0": { - "Eloquent\\Equality": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Erin Millard", - "email": "ezzatron@gmail.com", - "homepage": "http://ezzatron.com/" - } - ], - "description": "A better strict comparison for PHP.", - "homepage": "https://github.com/eloquent/equality", - "keywords": [ - "comparison", - "deep", - "equality", - "object", - "strict" - ], - "time": "2013-03-04 09:38:33" - }, - { - "name": "eloquent/typhax", - "version": "0.9.1", - "source": { - "type": "git", - "url": "https://github.com/eloquent/typhax.git", - "reference": "5ef82d0c72ad9a0bd1a3c3e624f67dc8c6c870ef" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/eloquent/typhax/zipball/5ef82d0c72ad9a0bd1a3c3e624f67dc8c6c870ef", - "reference": "5ef82d0c72ad9a0bd1a3c3e624f67dc8c6c870ef", - "shasum": "" - }, - "require": { - "eloquent/cosmos": "~2", - "ext-mbstring": "*", - "php": ">=5.3.0" - }, - "require-dev": { - "icecave/archer": "~0.2" - }, - "type": "library", - "autoload": { - "psr-0": { - "Eloquent\\Typhax": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Erin Millard", - "email": "ezzatron@gmail.com", - "homepage": "http://ezzatron.com/" - } - ], - "description": "A flexible PHP type hinting syntax.", - "homepage": "https://github.com/eloquent/typhax", - "keywords": [ - "check", - "checking", - "hint", - "hinting", - "parser", - "syntax", - "type" - ], - "time": "2013-03-04 10:28:53" - }, - { - "name": "eloquent/typhoon", - "version": "0.9.0", - "source": { - "type": "git", - "url": "https://github.com/eloquent/typhoon.git", - "reference": "12c32df4138229d8add4211da4adfc611e3b1f54" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/eloquent/typhoon/zipball/12c32df4138229d8add4211da4adfc611e3b1f54", - "reference": "12c32df4138229d8add4211da4adfc611e3b1f54", - "shasum": "" - }, - "require": { - "eloquent/asplode": "~1", - "eloquent/blox": "~1", - "eloquent/cosmos": "~2", - "eloquent/enumeration": "~3", - "eloquent/typhax": "~0.9", - "icecave/isolator": "~2", - "icecave/pasta-ast": "~0.1", - "icecave/rasta": "~0.1", - "php": ">=5.3.0", - "symfony/console": "~2", - "symfony/filesystem": "~2" - }, - "require-dev": { - "eloquent/liberator": "~1", - "ezzatron/phpunit-extensions": "~1", - "icecave/archer": "~0.1" - }, - "bin": [ - "bin/typhoon" - ], - "type": "library", - "autoload": { - "psr-0": { - "Eloquent\\Typhoon\\TypeCheck": "src-typhoon", - "Eloquent\\Typhoon": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Erin Millard", - "email": "ezzatron@gmail.com", - "homepage": "http://ezzatron.com/" - } - ], - "description": "Simple, flexible type-checking for PHP.", - "homepage": "https://github.com/eloquent/typhoon", - "keywords": [ - "check", - "checking", - "hint", - "hinting", - "type" - ], - "time": "2013-02-18 23:16:04" - }, { "name": "guzzle/guzzle", - "version": "v3.7.3", + "version": "v3.9.2", "source": { "type": "git", - "url": "https://github.com/guzzle/guzzle.git", - "reference": "0f16aad385528b5cf790392cb4a4d16cf600e944" + "url": "https://github.com/guzzle/guzzle3.git", + "reference": "54991459675c1a2924122afbb0e5609ade581155" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/0f16aad385528b5cf790392cb4a4d16cf600e944", - "reference": "0f16aad385528b5cf790392cb4a4d16cf600e944", + "url": "https://api.github.com/repos/guzzle/guzzle3/zipball/54991459675c1a2924122afbb0e5609ade581155", + "reference": "54991459675c1a2924122afbb0e5609ade581155", "shasum": "" }, "require": { "ext-curl": "*", - "php": ">=5.3.2", - "symfony/event-dispatcher": ">=2.1" + "php": ">=5.3.3", + "symfony/event-dispatcher": "~2.1" }, "replace": { "guzzle/batch": "self.version", @@ -572,24 +210,24 @@ "guzzle/stream": "self.version" }, "require-dev": { - "doctrine/cache": "*", - "monolog/monolog": "1.*", + "doctrine/cache": "~1.3", + "monolog/monolog": "~1.0", "phpunit/phpunit": "3.7.*", - "psr/log": "1.0.*", - "symfony/class-loader": "*", - "zendframework/zend-cache": "2.0.*", - "zendframework/zend-log": "2.0.*" + "psr/log": "~1.0", + "symfony/class-loader": "~2.1", + "zendframework/zend-cache": "2.*,<2.3", + "zendframework/zend-log": "2.*,<2.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.7-dev" + "dev-master": "3.9-dev" } }, "autoload": { "psr-0": { - "Guzzle\\Tests": "tests/", - "Guzzle": "src/" + "Guzzle": "src/", + "Guzzle\\Tests": "tests/" } }, "notification-url": "https://packagist.org/downloads/", @@ -618,29 +256,29 @@ "rest", "web service" ], - "time": "2013-09-08 21:09:18" + "time": "2014-08-11 04:32:36" }, { "name": "icecave/archer", - "version": "1.0.1", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/IcecaveStudios/archer.git", - "reference": "b0152a3274a5a5e0b8bbac81baaaa74fe5a40290" + "reference": "49e90d8c0d0a63e537b26d90591367093ebf45be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/IcecaveStudios/archer/zipball/b0152a3274a5a5e0b8bbac81baaaa74fe5a40290", - "reference": "b0152a3274a5a5e0b8bbac81baaaa74fe5a40290", + "url": "https://api.github.com/repos/IcecaveStudios/archer/zipball/49e90d8c0d0a63e537b26d90591367093ebf45be", + "reference": "49e90d8c0d0a63e537b26d90591367093ebf45be", "shasum": "" }, "require": { "phake/phake": "~1", "php": ">=5.3", - "sami/sami": "~1", + "sami/sami": "~1.1.0", "satooshi/php-coveralls": "~0.6", "symfony/console": "~2", - "symfony/process": "~2,<2.3.5" + "symfony/process": "~2" }, "require-dev": { "eloquent/liberator": "~1", @@ -655,8 +293,8 @@ ], "type": "library", "autoload": { - "psr-0": { - "Icecave\\Archer": "src" + "psr-4": { + "Icecave\\Archer\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -690,291 +328,24 @@ "testing", "unit" ], - "time": "2013-10-01 04:03:32" - }, - { - "name": "icecave/collections", - "version": "0.8.0", - "source": { - "type": "git", - "url": "https://github.com/IcecaveStudios/collections.git", - "reference": "c12f606057b91c956a5af4ae7bdd7a13fdbedcd9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/IcecaveStudios/collections/zipball/c12f606057b91c956a5af4ae7bdd7a13fdbedcd9", - "reference": "c12f606057b91c956a5af4ae7bdd7a13fdbedcd9", - "shasum": "" - }, - "require": { - "ext-mbstring": "*", - "icecave/parity": "~0.1.0", - "icecave/repr": "~1", - "php": ">=5.3" - }, - "require-dev": { - "eloquent/liberator": "~1", - "eloquent/typhoon": "~0.9.0", - "ezzatron/phpunit-extensions": "~1", - "icecave/archer": "~1" - }, - "type": "library", - "extra": { - "typhoon": { - "output-path": "src-typhoon", - "validator-namespace": "Icecave\\Collections\\TypeCheck", - "use-native-callable": false - } - }, - "autoload": { - "psr-0": { - "Icecave\\Collections": "src", - "Icecave\\Collections\\TypeCheck": "src-typhoon" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "James Harris", - "email": "james.harris@icecave.com.au", - "homepage": "https://github.com/jmalloc" - } - ], - "description": "A PHP collection library loosely inspired by the .NET runtime and the C++ STL.", - "homepage": "https://github.com/IcecaveStudios/collections", - "keywords": [ - "array", - "collection", - "container", - "hash", - "map", - "queue", - "sequence", - "stack" - ], - "time": "2013-09-23 04:36:07" - }, - { - "name": "icecave/parity", - "version": "0.1.0", - "source": { - "type": "git", - "url": "https://github.com/IcecaveStudios/parity.git", - "reference": "a68a1c645ced693f34cd39b0da1e44d803fcc7f2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/IcecaveStudios/parity/zipball/a68a1c645ced693f34cd39b0da1e44d803fcc7f2", - "reference": "a68a1c645ced693f34cd39b0da1e44d803fcc7f2", - "shasum": "" - }, - "require": { - "icecave/repr": "~1", - "php": ">=5.3" - }, - "require-dev": { - "eloquent/typhoon": "~0.9", - "icecave/archer": "~0.3" - }, - "type": "library", - "extra": { - "typhoon": { - "output-path": "lib-typhoon", - "validator-namespace": "Icecave\\Parity\\TypeCheck", - "use-native-callable": false - } - }, - "autoload": { - "psr-0": { - "Icecave\\Parity": "lib", - "Icecave\\Parity\\TypeCheck": "lib-typhoon" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "James Harris", - "email": "james.harris@icecave.com.au", - "homepage": "https://github.com/jmalloc" - } - ], - "description": "A comparator library for PHP.", - "homepage": "https://github.com/IcecaveStudios/parity", - "keywords": [ - "compare", - "comparison", - "equal", - "equality", - "greater", - "less", - "sort", - "sorting" - ], - "time": "2013-05-29 08:00:22" - }, - { - "name": "icecave/pasta-ast", - "version": "0.1.0", - "source": { - "type": "git", - "url": "https://github.com/IcecaveStudios/pasta-ast.git", - "reference": "e60498ac26189a50990b190d34a61b3677a14a69" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/IcecaveStudios/pasta-ast/zipball/e60498ac26189a50990b190d34a61b3677a14a69", - "reference": "e60498ac26189a50990b190d34a61b3677a14a69", - "shasum": "" - }, - "require": { - "eloquent/enumeration": "3.*", - "php": ">=5.3.0" - }, - "require-dev": { - "phake/phake": "1.*" - }, - "type": "library", - "autoload": { - "psr-0": { - "Icecave\\Pasta\\AST": "lib" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "James Harris", - "email": "james.harris@icecave.com.au", - "homepage": "https://github.com/jmalloc" - } - ], - "description": "PHP AST implementation.", - "homepage": "https://github.com/IcecaveStudios/pasta-ast", - "keywords": [ - "abstract", - "ast", - "parser", - "syntax", - "tree" - ], - "time": "2012-11-28 12:00:39" - }, - { - "name": "icecave/rasta", - "version": "0.1.4", - "source": { - "type": "git", - "url": "https://github.com/IcecaveStudios/rasta.git", - "reference": "aa384531bcab779af0fc25552287866b470ece00" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/IcecaveStudios/rasta/zipball/aa384531bcab779af0fc25552287866b470ece00", - "reference": "aa384531bcab779af0fc25552287866b470ece00", - "shasum": "" - }, - "require": { - "icecave/collections": "*", - "icecave/pasta-ast": "0.1.*", - "php": ">=5.3.0" - }, - "require-dev": { - "icecave/testing": "1.*" - }, - "type": "library", - "autoload": { - "psr-0": { - "Icecave\\Rasta": "lib" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "James Harris", - "email": "james.harris@icecave.com.au", - "homepage": "https://github.com/jmalloc" - } - ], - "description": "PHP code generation library.", - "homepage": "https://github.com/IcecaveStudios/rasta", - "keywords": [ - "ast", - "parser" - ], - "time": "2013-01-14 14:06:52" - }, - { - "name": "icecave/repr", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/IcecaveStudios/repr.git", - "reference": "9a78b2b12dbb6fbf46d995f7255ee1f1118bfd8b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/IcecaveStudios/repr/zipball/9a78b2b12dbb6fbf46d995f7255ee1f1118bfd8b", - "reference": "9a78b2b12dbb6fbf46d995f7255ee1f1118bfd8b", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "require-dev": { - "phake/phake": "1.*" - }, - "type": "library", - "autoload": { - "psr-0": { - "Icecave\\Repr": "lib" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "James Harris", - "email": "james.harris@icecave.com.au", - "homepage": "https://github.com/jmalloc" - } - ], - "description": "Human readable string representations of everything.", - "homepage": "https://github.com/IcecaveStudios/repr", - "keywords": [ - "repr", - "representation", - "string" - ], - "time": "2013-01-11 00:04:43" + "time": "2014-06-23 00:33:17" }, { "name": "nikic/php-parser", - "version": "v0.9.4", + "version": "v0.9.5", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "1e5e280ae88a27effa2ae4aa2bd088494ed8594f" + "reference": "ef70767475434bdb3615b43c327e2cae17ef12eb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/1e5e280ae88a27effa2ae4aa2bd088494ed8594f", - "reference": "1e5e280ae88a27effa2ae4aa2bd088494ed8594f", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/ef70767475434bdb3615b43c327e2cae17ef12eb", + "reference": "ef70767475434bdb3615b43c327e2cae17ef12eb", "shasum": "" }, "require": { + "ext-tokenizer": "*", "php": ">=5.2" }, "type": "library", @@ -1002,25 +373,31 @@ "parser", "php" ], - "time": "2013-08-25 17:11:40" + "time": "2014-07-23 18:24:17" }, { "name": "phake/phake", - "version": "v1.0.3", + "version": "v1.0.5", "source": { "type": "git", "url": "https://github.com/mlively/Phake.git", - "reference": "4d822246b401f4dc609500d47e42dac8df645f4f" + "reference": "14e4788698e4a21774220c22f3dcaa2e97648b61" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mlively/Phake/zipball/4d822246b401f4dc609500d47e42dac8df645f4f", - "reference": "4d822246b401f4dc609500d47e42dac8df645f4f", + "url": "https://api.github.com/repos/mlively/Phake/zipball/14e4788698e4a21774220c22f3dcaa2e97648b61", + "reference": "14e4788698e4a21774220c22f3dcaa2e97648b61", "shasum": "" }, "require": { "php": ">=5.2.0" }, + "require-dev": { + "doctrine/common": "2.3.*", + "ext-soap": "*", + "hamcrest/hamcrest-php": "1.1.*", + "phpunit/phpunit": "3.7.*" + }, "type": "library", "autoload": { "classmap": [ @@ -1046,7 +423,7 @@ "mock", "testing" ], - "time": "2012-05-14 15:06:51" + "time": "2014-04-16 14:49:56" }, { "name": "pimple/pimple", @@ -1134,16 +511,16 @@ }, { "name": "sami/sami", - "version": "v1.2", + "version": "v1.1", "source": { "type": "git", "url": "https://github.com/fabpot/Sami.git", - "reference": "8d6d896c48766e0cb08b651fb5aca77a1dd788e0" + "reference": "46c58957ce4823c613e8535626b81e2fd80a9865" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fabpot/Sami/zipball/8d6d896c48766e0cb08b651fb5aca77a1dd788e0", - "reference": "8d6d896c48766e0cb08b651fb5aca77a1dd788e0", + "url": "https://api.github.com/repos/fabpot/Sami/zipball/46c58957ce4823c613e8535626b81e2fd80a9865", + "reference": "46c58957ce4823c613e8535626b81e2fd80a9865", "shasum": "" }, "require": { @@ -1164,7 +541,7 @@ "type": "application", "extra": { "branch-alias": { - "dev-master": "1.2-dev" + "dev-master": "1.0-dev" } }, "autoload": { @@ -1187,7 +564,7 @@ "keywords": [ "phpdoc" ], - "time": "2013-09-27 17:24:21" + "time": "2013-08-04 13:56:41" }, { "name": "satooshi/php-coveralls", @@ -1259,17 +636,17 @@ }, { "name": "symfony/config", - "version": "v2.3.5", + "version": "v2.5.4", "target-dir": "Symfony/Component/Config", "source": { "type": "git", "url": "https://github.com/symfony/Config.git", - "reference": "1ced3d6c88b22df8cd1fe5209dbd6a89df362a29" + "reference": "080eabdc256c1d7a3a7cf6296271edb68eb1ab2b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Config/zipball/1ced3d6c88b22df8cd1fe5209dbd6a89df362a29", - "reference": "1ced3d6c88b22df8cd1fe5209dbd6a89df362a29", + "url": "https://api.github.com/repos/symfony/Config/zipball/080eabdc256c1d7a3a7cf6296271edb68eb1ab2b", + "reference": "080eabdc256c1d7a3a7cf6296271edb68eb1ab2b", "shasum": "" }, "require": { @@ -1279,7 +656,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev" + "dev-master": "2.5-dev" } }, "autoload": { @@ -1292,47 +669,49 @@ "MIT" ], "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, { "name": "Symfony Community", "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" } ], "description": "Symfony Config Component", "homepage": "http://symfony.com", - "time": "2013-09-19 09:45:20" + "time": "2014-08-31 03:22:04" }, { "name": "symfony/console", - "version": "v2.3.5", + "version": "v2.5.4", "target-dir": "Symfony/Component/Console", "source": { "type": "git", "url": "https://github.com/symfony/Console.git", - "reference": "f880062d56edefb25b36f2defa65aafe65959dc7" + "reference": "748beed2a1e73179c3f5154d33fe6ae100c1aeb1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Console/zipball/f880062d56edefb25b36f2defa65aafe65959dc7", - "reference": "f880062d56edefb25b36f2defa65aafe65959dc7", + "url": "https://api.github.com/repos/symfony/Console/zipball/748beed2a1e73179c3f5154d33fe6ae100c1aeb1", + "reference": "748beed2a1e73179c3f5154d33fe6ae100c1aeb1", "shasum": "" }, "require": { "php": ">=5.3.3" }, "require-dev": { + "psr/log": "~1.0", "symfony/event-dispatcher": "~2.1" }, "suggest": { + "psr/log": "For using the console logger", "symfony/event-dispatcher": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev" + "dev-master": "2.5-dev" } }, "autoload": { @@ -1345,39 +724,42 @@ "MIT" ], "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, { "name": "Symfony Community", "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" } ], "description": "Symfony Console Component", "homepage": "http://symfony.com", - "time": "2013-09-25 06:04:15" + "time": "2014-08-14 16:10:54" }, { "name": "symfony/event-dispatcher", - "version": "v2.3.5", + "version": "v2.5.4", "target-dir": "Symfony/Component/EventDispatcher", "source": { "type": "git", "url": "https://github.com/symfony/EventDispatcher.git", - "reference": "7fc72a7a346a1887d3968cc1ce5642a15cd182e9" + "reference": "8faf5cc7e80fde74a650a36e60d32ce3c3e0457b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/7fc72a7a346a1887d3968cc1ce5642a15cd182e9", - "reference": "7fc72a7a346a1887d3968cc1ce5642a15cd182e9", + "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/8faf5cc7e80fde74a650a36e60d32ce3c3e0457b", + "reference": "8faf5cc7e80fde74a650a36e60d32ce3c3e0457b", "shasum": "" }, "require": { "php": ">=5.3.3" }, "require-dev": { - "symfony/dependency-injection": "~2.0" + "psr/log": "~1.0", + "symfony/config": "~2.0", + "symfony/dependency-injection": "~2.0", + "symfony/stopwatch": "~2.2" }, "suggest": { "symfony/dependency-injection": "", @@ -1386,7 +768,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev" + "dev-master": "2.5-dev" } }, "autoload": { @@ -1399,32 +781,32 @@ "MIT" ], "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, { "name": "Symfony Community", "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" } ], "description": "Symfony EventDispatcher Component", "homepage": "http://symfony.com", - "time": "2013-09-19 09:45:20" + "time": "2014-07-28 13:20:46" }, { "name": "symfony/finder", - "version": "v2.3.5", + "version": "v2.5.4", "target-dir": "Symfony/Component/Finder", "source": { "type": "git", "url": "https://github.com/symfony/Finder.git", - "reference": "a175521f680b178e63c5d0ab87c6b046c0990c3f" + "reference": "f40854d1a19c339c7f969f8f6d6d6e9153311c4c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Finder/zipball/a175521f680b178e63c5d0ab87c6b046c0990c3f", - "reference": "a175521f680b178e63c5d0ab87c6b046c0990c3f", + "url": "https://api.github.com/repos/symfony/Finder/zipball/f40854d1a19c339c7f969f8f6d6d6e9153311c4c", + "reference": "f40854d1a19c339c7f969f8f6d6d6e9153311c4c", "shasum": "" }, "require": { @@ -1433,7 +815,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev" + "dev-master": "2.5-dev" } }, "autoload": { @@ -1446,32 +828,32 @@ "MIT" ], "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, { "name": "Symfony Community", "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" } ], "description": "Symfony Finder Component", "homepage": "http://symfony.com", - "time": "2013-09-19 09:45:20" + "time": "2014-09-03 09:00:14" }, { "name": "symfony/process", - "version": "v2.3.4", + "version": "v2.5.4", "target-dir": "Symfony/Component/Process", "source": { "type": "git", "url": "https://github.com/symfony/Process.git", - "reference": "1e91553e1cedd0b8fb1da6ea4f89b02e21713d5b" + "reference": "136cf0bdaacea81f779583376d47dd8aef4fc6ba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Process/zipball/1e91553e1cedd0b8fb1da6ea4f89b02e21713d5b", - "reference": "1e91553e1cedd0b8fb1da6ea4f89b02e21713d5b", + "url": "https://api.github.com/repos/symfony/Process/zipball/136cf0bdaacea81f779583376d47dd8aef4fc6ba", + "reference": "136cf0bdaacea81f779583376d47dd8aef4fc6ba", "shasum": "" }, "require": { @@ -1480,7 +862,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev" + "dev-master": "2.5-dev" } }, "autoload": { @@ -1493,32 +875,32 @@ "MIT" ], "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, { "name": "Symfony Community", "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" } ], "description": "Symfony Process Component", "homepage": "http://symfony.com", - "time": "2013-08-22 06:42:25" + "time": "2014-08-31 03:22:04" }, { "name": "symfony/stopwatch", - "version": "v2.3.5", + "version": "v2.5.4", "target-dir": "Symfony/Component/Stopwatch", "source": { "type": "git", "url": "https://github.com/symfony/Stopwatch.git", - "reference": "1f951fa881d2e661525e81ee0afc97261ad43459" + "reference": "22ab4f76cdeefd38b00022a6be5709190a2fd046" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Stopwatch/zipball/1f951fa881d2e661525e81ee0afc97261ad43459", - "reference": "1f951fa881d2e661525e81ee0afc97261ad43459", + "url": "https://api.github.com/repos/symfony/Stopwatch/zipball/22ab4f76cdeefd38b00022a6be5709190a2fd046", + "reference": "22ab4f76cdeefd38b00022a6be5709190a2fd046", "shasum": "" }, "require": { @@ -1527,7 +909,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev" + "dev-master": "2.5-dev" } }, "autoload": { @@ -1540,32 +922,32 @@ "MIT" ], "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, { "name": "Symfony Community", "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" } ], "description": "Symfony Stopwatch Component", "homepage": "http://symfony.com", - "time": "2013-09-19 09:45:20" + "time": "2014-08-14 16:10:54" }, { "name": "symfony/yaml", - "version": "v2.3.5", + "version": "v2.5.4", "target-dir": "Symfony/Component/Yaml", "source": { "type": "git", "url": "https://github.com/symfony/Yaml.git", - "reference": "6bb881b948368482e1abf1a75c08bcf88a1c5fc3" + "reference": "01a7695bcfb013d0a15c6757e15aae120342986f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Yaml/zipball/6bb881b948368482e1abf1a75c08bcf88a1c5fc3", - "reference": "6bb881b948368482e1abf1a75c08bcf88a1c5fc3", + "url": "https://api.github.com/repos/symfony/Yaml/zipball/01a7695bcfb013d0a15c6757e15aae120342986f", + "reference": "01a7695bcfb013d0a15c6757e15aae120342986f", "shasum": "" }, "require": { @@ -1574,7 +956,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev" + "dev-master": "2.5-dev" } }, "autoload": { @@ -1587,31 +969,31 @@ "MIT" ], "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, { "name": "Symfony Community", "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" } ], "description": "Symfony Yaml Component", "homepage": "http://symfony.com", - "time": "2013-09-22 18:04:39" + "time": "2014-08-31 03:22:04" }, { "name": "twig/twig", - "version": "v1.13.2", + "version": "v1.16.0", "source": { "type": "git", "url": "https://github.com/fabpot/Twig.git", - "reference": "6d6a1009427d1f398c9d40904147bf9f723d5755" + "reference": "8ce37115802e257a984a82d38254884085060024" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fabpot/Twig/zipball/6d6a1009427d1f398c9d40904147bf9f723d5755", - "reference": "6d6a1009427d1f398c9d40904147bf9f723d5755", + "url": "https://api.github.com/repos/fabpot/Twig/zipball/8ce37115802e257a984a82d38254884085060024", + "reference": "8ce37115802e257a984a82d38254884085060024", "shasum": "" }, "require": { @@ -1620,7 +1002,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.13-dev" + "dev-master": "1.16-dev" } }, "autoload": { @@ -1635,11 +1017,19 @@ "authors": [ { "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" }, { "name": "Armin Ronacher", - "email": "armin.ronacher@active-4.com" + "email": "armin.ronacher@active-4.com", + "role": "Project Founder" + }, + { + "name": "Twig Team", + "homepage": "https://github.com/fabpot/Twig/graphs/contributors", + "role": "Contributors" } ], "description": "Twig, the flexible, fast, and secure template language for PHP", @@ -1647,20 +1037,15 @@ "keywords": [ "templating" ], - "time": "2013-08-03 15:35:31" + "time": "2014-07-05 12:19:05" } ], - "aliases": [ - - ], + "aliases": [], "minimum-stability": "stable", - "stability-flags": [ - - ], + "stability-flags": [], + "prefer-stable": false, "platform": { "php": ">=5.3" }, - "platform-dev": [ - - ] + "platform-dev": [] } diff --git a/src-typhoon/Icecave/Temptation/TypeCheck/AbstractValidator.php b/src-typhoon/Icecave/Temptation/TypeCheck/AbstractValidator.php deleted file mode 100644 index eb54e2f..0000000 --- a/src-typhoon/Icecave/Temptation/TypeCheck/AbstractValidator.php +++ /dev/null @@ -1,21 +0,0 @@ -reflector = new \ReflectionObject($this); - } - - public function __call($name, array $arguments) - { - $validatorMethodName = \sprintf('validate%s', \ucfirst(\ltrim($name, '_'))); - if (!$this->reflector->hasMethod($validatorMethodName)) { - throw new \BadMethodCallException(\sprintf('Call to undefined method %s::%s().', __CLASS__, $name)); - } - return $this->reflector->getMethod($validatorMethodName)->invokeArgs($this, $arguments); - } - - private $reflector; -} diff --git a/src-typhoon/Icecave/Temptation/TypeCheck/DummyValidator.php b/src-typhoon/Icecave/Temptation/TypeCheck/DummyValidator.php deleted file mode 100644 index 9d8177b..0000000 --- a/src-typhoon/Icecave/Temptation/TypeCheck/DummyValidator.php +++ /dev/null @@ -1,10 +0,0 @@ -parameterName = $parameterName; - $this->index = $index; - $this->expectedType = $expectedType; - parent::__construct( - \sprintf( - 'Missing argument for parameter \'%s\' at index %d. Expected \'%s\'.', - $parameterName, - $index, - $expectedType - ), - $previous - ); - } - - public function parameterName() - { - return $this->parameterName; - } - - public function index() - { - return $this->index; - } - - public function expectedType() - { - return $this->expectedType; - } - - private $parameterName; - private $index; - private $expectedType; -} diff --git a/src-typhoon/Icecave/Temptation/TypeCheck/Exception/UnexpectedArgumentException.php b/src-typhoon/Icecave/Temptation/TypeCheck/Exception/UnexpectedArgumentException.php deleted file mode 100644 index 6689f73..0000000 --- a/src-typhoon/Icecave/Temptation/TypeCheck/Exception/UnexpectedArgumentException.php +++ /dev/null @@ -1,42 +0,0 @@ -index = $index; - $this->value = $value; - $this->typeInspector = $typeInspector; - $this->unexpectedType = $typeInspector->type($this->value); - parent::__construct(\sprintf('Unexpected argument of type \'%s\' at index %d.', $this->unexpectedType, $index), $previous); - } - - public function index() - { - return $this->index; - } - - public function value() - { - return $this->value; - } - - public function typeInspector() - { - return $this->typeInspector; - } - - public function unexpectedType() - { - return $this->unexpectedType; - } - - private $index; - private $value; - private $typeInspector; - private $unexpectedValue; -} diff --git a/src-typhoon/Icecave/Temptation/TypeCheck/Exception/UnexpectedArgumentValueException.php b/src-typhoon/Icecave/Temptation/TypeCheck/Exception/UnexpectedArgumentValueException.php deleted file mode 100644 index c20bd25..0000000 --- a/src-typhoon/Icecave/Temptation/TypeCheck/Exception/UnexpectedArgumentValueException.php +++ /dev/null @@ -1,65 +0,0 @@ -parameterName = $parameterName; - $this->index = $index; - $this->value = $value; - $this->expectedType = $expectedType; - $this->typeInspector = $typeInspector; - $this->unexpectedType = $typeInspector->type($this->value); - parent::__construct( - \sprintf( - 'Unexpected argument of type \'%s\' for parameter \'%s\' at index %d. Expected \'%s\'.', - $this->unexpectedType, - $parameterName, - $index, - $expectedType - ), - $previous - ); - } - - public function parameterName() - { - return $this->parameterName; - } - - public function index() - { - return $this->index; - } - - public function value() - { - return $this->value; - } - - public function expectedType() - { - return $this->expectedType; - } - - public function typeInspector() - { - return $this->typeInspector; - } - - public function unexpectedType() - { - return $this->unexpectedType; - } - - private $parameterName; - private $index; - private $value; - private $expectedValue; - private $typeInspector; - private $unexpectedValue; -} diff --git a/src-typhoon/Icecave/Temptation/TypeCheck/Exception/UnexpectedInputException.php b/src-typhoon/Icecave/Temptation/TypeCheck/Exception/UnexpectedInputException.php deleted file mode 100644 index 06d7a90..0000000 --- a/src-typhoon/Icecave/Temptation/TypeCheck/Exception/UnexpectedInputException.php +++ /dev/null @@ -1,11 +0,0 @@ -validateConstruct($arguments); - } - return $validator; - } - - public static function install($className, $validator) - { - static::$instances[$className] = $validator; - } - - public static function setRuntimeGeneration($runtimeGeneration) - { - static::$runtimeGeneration = $runtimeGeneration; - } - - public static function runtimeGeneration() - { - return static::$runtimeGeneration; - } - - protected static function createValidator($className) - { - $validatorClassName = '\\Icecave\\Temptation\\TypeCheck\\Validator\\' . $className . 'TypeCheck'; - if (static::runtimeGeneration() && !\class_exists($validatorClassName)) { - static::$dummyMode = true; - static::defineValidator($className); - static::$dummyMode = false; - } - return new $validatorClassName; - } - - protected static function defineValidator($className, \Eloquent\Typhoon\Generator\ValidatorClassGenerator $classGenerator = null) - { - if (null === $classGenerator) { - $classGenerator = new \Eloquent\Typhoon\Generator\ValidatorClassGenerator; - } - eval('?>' . $classGenerator->generateFromClass(static::configuration(), new \ReflectionClass($className))); - } - - protected static function configuration() - { - return new \Eloquent\Typhoon\Configuration\RuntimeConfiguration(\Eloquent\Cosmos\ClassName::fromString('\\Icecave\\Temptation\\TypeCheck'), false); - } - - private static $instances = array(); - private static $dummyMode = false; - private static $runtimeGeneration = false; -} diff --git a/src-typhoon/Icecave/Temptation/TypeCheck/TypeInspector.php b/src-typhoon/Icecave/Temptation/TypeCheck/TypeInspector.php deleted file mode 100644 index 5dbea1c..0000000 --- a/src-typhoon/Icecave/Temptation/TypeCheck/TypeInspector.php +++ /dev/null @@ -1,91 +0,0 @@ -arrayType($value, $maxIterations); - } - if ('double' === $nativeType) { - return 'float'; - } - if ('NULL' === $nativeType) { - return 'null'; - } - if ('object' === $nativeType) { - return $this->objectType($value, $maxIterations); - } - if ('resource' === $nativeType) { - return $this->resourceType($value); - } - return $nativeType; - } - - protected function arrayType(array $value, $maxIterations) - { - return \sprintf('array%s', $this->traversableSubTypes($value, $maxIterations)); - } - - protected function objectType($value, $maxIterations) - { - $reflector = new \ReflectionObject($value); - $class = $reflector->getName(); - $traversableSubTypes = ''; - if ($value instanceof \Traversable) { - $traversableSubTypes = $this->traversableSubTypes($value, $maxIterations); - } - return \sprintf('%s%s', $class, $traversableSubTypes); - } - - protected function traversableSubTypes($value, $maxIterations) - { - $keyTypes = array(); - $valueTypes = array(); - $i = 0; - foreach ($value as $key => $subValue) { - \array_push($keyTypes, $this->type($key)); - \array_push($valueTypes, $this->type($subValue)); - $i++; - if ($i >= $maxIterations) { - break; - } - } - if (\count($valueTypes) < 1) { - return ''; - } - $keyTypes = \array_unique($keyTypes); - \sort($keyTypes, SORT_STRING); - $valueTypes = \array_unique($valueTypes); - \sort($valueTypes, SORT_STRING); - return \sprintf('<%s, %s>', \implode('|', $keyTypes), \implode('|', $valueTypes)); - } - - protected function resourceType($value) - { - $ofType = \get_resource_type($value); - if ('stream' === $ofType) { - return $this->streamType($value); - } - return \sprintf('resource {ofType: %s}', $ofType); - } - - protected function streamType($value) - { - $metaData = \stream_get_meta_data($value); - if (\preg_match('/[r+]/', $metaData['mode'])) { - $readable = 'true'; - } else { - $readable = 'false'; - } - if (\preg_match('/[waxc+]/', $metaData['mode'])) { - $writable = 'true'; - } else { - $writable = 'false'; - } - return \sprintf('stream {readable: %s, writable: %s}', $readable, $writable); - } - -} diff --git a/src-typhoon/Icecave/Temptation/TypeCheck/Validator/Icecave/Temptation/AbstractTemporaryNodeTypeCheck.php b/src-typhoon/Icecave/Temptation/TypeCheck/Validator/Icecave/Temptation/AbstractTemporaryNodeTypeCheck.php deleted file mode 100644 index 2448207..0000000 --- a/src-typhoon/Icecave/Temptation/TypeCheck/Validator/Icecave/Temptation/AbstractTemporaryNodeTypeCheck.php +++ /dev/null @@ -1,70 +0,0 @@ - 2) { - throw new \Icecave\Temptation\TypeCheck\Exception\UnexpectedArgumentException(2, $arguments[2]); - } - $value = $arguments[0]; - if (!\is_string($value)) { - throw new \Icecave\Temptation\TypeCheck\Exception\UnexpectedArgumentValueException( - 'path', - 0, - $arguments[0], - 'string' - ); - } - } - - public function validateDestruct(array $arguments) - { - if (\count($arguments) > 0) { - throw new \Icecave\Temptation\TypeCheck\Exception\UnexpectedArgumentException(0, $arguments[0]); - } - } - - public function path(array $arguments) - { - if (\count($arguments) > 0) { - throw new \Icecave\Temptation\TypeCheck\Exception\UnexpectedArgumentException(0, $arguments[0]); - } - } - - public function delete(array $arguments) - { - if (\count($arguments) > 0) { - throw new \Icecave\Temptation\TypeCheck\Exception\UnexpectedArgumentException(0, $arguments[0]); - } - } - - public function release(array $arguments) - { - if (\count($arguments) > 0) { - throw new \Icecave\Temptation\TypeCheck\Exception\UnexpectedArgumentException(0, $arguments[0]); - } - } - - public function isReleased(array $arguments) - { - if (\count($arguments) > 0) { - throw new \Icecave\Temptation\TypeCheck\Exception\UnexpectedArgumentException(0, $arguments[0]); - } - } - - public function fileSystem(array $arguments) - { - if (\count($arguments) > 0) { - throw new \Icecave\Temptation\TypeCheck\Exception\UnexpectedArgumentException(0, $arguments[0]); - } - } - -} diff --git a/src-typhoon/Icecave/Temptation/TypeCheck/Validator/Icecave/Temptation/Exception/TemporaryNodeReleasedExceptionTypeCheck.php b/src-typhoon/Icecave/Temptation/TypeCheck/Validator/Icecave/Temptation/Exception/TemporaryNodeReleasedExceptionTypeCheck.php deleted file mode 100644 index 48be17a..0000000 --- a/src-typhoon/Icecave/Temptation/TypeCheck/Validator/Icecave/Temptation/Exception/TemporaryNodeReleasedExceptionTypeCheck.php +++ /dev/null @@ -1,6 +0,0 @@ - 2) { - throw new \Icecave\Temptation\TypeCheck\Exception\UnexpectedArgumentException(2, $arguments[2]); - } - } - - public function createDirectory(array $arguments) - { - $argumentCount = \count($arguments); - if ($argumentCount > 1) { - throw new \Icecave\Temptation\TypeCheck\Exception\UnexpectedArgumentException(1, $arguments[1]); - } - if ($argumentCount > 0) { - $value = $arguments[0]; - if (!\is_int($value)) { - throw new \Icecave\Temptation\TypeCheck\Exception\UnexpectedArgumentValueException( - 'mode', - 0, - $arguments[0], - 'integer' - ); - } - } - } - - public function createFile(array $arguments) - { - $argumentCount = \count($arguments); - if ($argumentCount > 1) { - throw new \Icecave\Temptation\TypeCheck\Exception\UnexpectedArgumentException(1, $arguments[1]); - } - if ($argumentCount > 0) { - $value = $arguments[0]; - if (!\is_int($value)) { - throw new \Icecave\Temptation\TypeCheck\Exception\UnexpectedArgumentValueException( - 'mode', - 0, - $arguments[0], - 'integer' - ); - } - } - } - - public function fileSystem(array $arguments) - { - if (\count($arguments) > 0) { - throw new \Icecave\Temptation\TypeCheck\Exception\UnexpectedArgumentException(0, $arguments[0]); - } - } - - public function generatePath(array $arguments) - { - if (\count($arguments) > 0) { - throw new \Icecave\Temptation\TypeCheck\Exception\UnexpectedArgumentException(0, $arguments[0]); - } - } - -} diff --git a/src/Icecave/Temptation/AbstractTemporaryNode.php b/src/AbstractTemporaryNode.php similarity index 86% rename from src/Icecave/Temptation/AbstractTemporaryNode.php rename to src/AbstractTemporaryNode.php index 6d67961..f546069 100644 --- a/src/Icecave/Temptation/AbstractTemporaryNode.php +++ b/src/AbstractTemporaryNode.php @@ -1,7 +1,6 @@ typeCheck = TypeCheck::get(__CLASS__, func_get_args()); - $this->path = $path; $this->fileSystem = $fileSystem; } @@ -39,8 +36,6 @@ public function __destruct() */ public function path() { - $this->typeCheck->path(func_get_args()); - if ($this->isReleased()) { throw new Exception\TemporaryNodeReleasedException; } @@ -54,8 +49,6 @@ public function path() */ public function delete() { - $this->typeCheck->delete(func_get_args()); - if ($this->isReleased()) { throw new Exception\TemporaryNodeReleasedException; } @@ -73,8 +66,6 @@ public function delete() */ public function release() { - $this->typeCheck->release(func_get_args()); - $this->fileSystem = null; return $this->path; @@ -87,8 +78,6 @@ public function release() */ public function isReleased() { - $this->typeCheck->isReleased(func_get_args()); - return null === $this->fileSystem; } @@ -99,12 +88,9 @@ public function isReleased() */ public function fileSystem() { - $this->typeCheck->fileSystem(func_get_args()); - return $this->fileSystem; } - private $typeCheck; private $path; private $fileSystem; } diff --git a/src/Exception/TemporaryNodeCreationFailedException.php b/src/Exception/TemporaryNodeCreationFailedException.php new file mode 100644 index 0000000..ddc3b09 --- /dev/null +++ b/src/Exception/TemporaryNodeCreationFailedException.php @@ -0,0 +1,12 @@ +typeCheck = TypeCheck::get(__CLASS__, func_get_args()); - if (null === $fileSystem) { $fileSystem = new Filesystem; } @@ -37,13 +35,18 @@ public function __construct(Filesystem $fileSystem = null, Isolator $isolator = */ public function createDirectory($mode = 0700) { - $this->typeCheck->createDirectory(func_get_args()); + $attempts = 3; - $path = $this->generatePath(); - $this->isolator->unlink($path); - $this->isolator->mkdir($path, $mode); + while ($attempts--) { + $path = $this->generatePath(); + $this->isolator->unlink($path); + + if (@$this->isolator->mkdir($path, $mode)) { + return new TemporaryDirectory($path, $this->fileSystem); + } + } - return new TemporaryDirectory($path, $this->fileSystem); + throw new TemporaryNodeCreationFailedException('Unable to create temporary directory.'); } /** @@ -57,8 +60,6 @@ public function createDirectory($mode = 0700) */ public function createFile($mode = 0600) { - $this->typeCheck->createFile(func_get_args()); - $path = $this->generatePath(); $this->isolator->chmod($path, $mode); @@ -72,8 +73,6 @@ public function createFile($mode = 0600) */ public function fileSystem() { - $this->typeCheck->fileSystem(func_get_args()); - return $this->fileSystem; } @@ -84,8 +83,6 @@ public function fileSystem() */ protected function generatePath() { - $this->typeCheck->generatePath(func_get_args()); - $path = $this->isolator->tempnam( $this->isolator->sys_get_temp_dir(), 'temptation-' @@ -94,7 +91,6 @@ protected function generatePath() return $path; } - private $typeCheck; private $fileSystem; private $isolator; } diff --git a/test/suite/Icecave/Temptation/AbstractTemporaryNodeTest.php b/test/suite/AbstractTemporaryNodeTest.php similarity index 100% rename from test/suite/Icecave/Temptation/AbstractTemporaryNodeTest.php rename to test/suite/AbstractTemporaryNodeTest.php diff --git a/test/suite/Exception/TemporaryNodeCreationFailedExceptionTest.php b/test/suite/Exception/TemporaryNodeCreationFailedExceptionTest.php new file mode 100644 index 0000000..b948d55 --- /dev/null +++ b/test/suite/Exception/TemporaryNodeCreationFailedExceptionTest.php @@ -0,0 +1,14 @@ +assertSame('Failed to create temporary node.', $exception->getMessage()); + } +} diff --git a/test/suite/Exception/TemporaryNodeReleasedExceptionTest.php b/test/suite/Exception/TemporaryNodeReleasedExceptionTest.php new file mode 100644 index 0000000..1c0b3dd --- /dev/null +++ b/test/suite/Exception/TemporaryNodeReleasedExceptionTest.php @@ -0,0 +1,14 @@ +assertSame('Temporary node has already been released.', $exception->getMessage()); + } +} diff --git a/test/suite/Icecave/Temptation/TemptationTest.php b/test/suite/TemptationTest.php similarity index 63% rename from test/suite/Icecave/Temptation/TemptationTest.php rename to test/suite/TemptationTest.php index 723e8a2..512f6a1 100644 --- a/test/suite/Icecave/Temptation/TemptationTest.php +++ b/test/suite/TemptationTest.php @@ -19,7 +19,13 @@ public function setUp() Phake::when($this->isolator) ->tempnam(Phake::anyParameters()) - ->thenReturn('/tmp/foo'); + ->thenReturn('/tmp/foo') + ->thenReturn('/tmp/bar') + ->thenReturn('/tmp/spam'); + + Phake::when($this->isolator) + ->mkdir(Phake::anyParameters()) + ->thenReturn(true); } public function testConstructorDefaults() @@ -45,6 +51,32 @@ public function testCreateDirectory() $this->assertSame($this->fileSystem, $result->fileSystem()); } + public function testCreateDirectoryFailure() + { + Phake::when($this->isolator) + ->mkdir(Phake::anyParameters()) + ->thenReturn(false); + + $this->setExpectedException(__NAMESPACE__ . '\Exception\TemporaryNodeCreationFailedException'); + + try { + $this->temptation->createDirectory(); + } catch (RuntimeException $e) { + Phake::inOrder( + Phake::verify($this->isolator)->sys_get_temp_dir(), + Phake::verify($this->isolator)->tempnam('/tmp', 'temptation-'), + Phake::verify($this->isolator)->unlink('/tmp/foo'), + Phake::verify($this->isolator)->mkdir('/tmp/foo', 0700), + Phake::verify($this->isolator)->unlink('/tmp/bar'), + Phake::verify($this->isolator)->mkdir('/tmp/bar', 0700), + Phake::verify($this->isolator)->unlink('/tmp/spam'), + Phake::verify($this->isolator)->mkdir('/tmp/spam', 0700) + ); + + throw $e; + } + } + public function testCreateFile() { $result = $this->temptation->createFile();