diff --git a/composer.json b/composer.json index 5f77b6f8..d54f83bf 100644 --- a/composer.json +++ b/composer.json @@ -30,7 +30,8 @@ "knplabs/packagist-api": "~1.0", "predis/predis": "0.8.*", "snc/redis-bundle": "~1.1", - "guzzle/plugin-cache": "*" + "guzzle/plugin-cache": "*", + "badges/poser": "dev-master" }, "require-dev": { "guzzle/plugin-mock": "*", @@ -56,7 +57,7 @@ "config": { "bin-dir": "bin" }, - "minimum-stability": "stable", + "minimum-stability": "dev", "extra": { "symfony-app-dir": "app", "symfony-web-dir": "web", diff --git a/composer.lock b/composer.lock index 1f8cabaa..872458be 100644 --- a/composer.lock +++ b/composer.lock @@ -1,22 +1,87 @@ { "_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": "dff4dba6f8f3e1dfde45ffc7a177923e", + "hash": "d5d083b6fa3cfc1ab8b9fca2f6679da2", "packages": [ + { + "name": "badges/poser", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/badges/poser.git", + "reference": "bf68b89c0b1eb530602f8592f54f540382b824b8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/badges/poser/zipball/bf68b89c0b1eb530602f8592f54f540382b824b8", + "reference": "bf68b89c0b1eb530602f8592f54f540382b824b8", + "shasum": "" + }, + "require": { + "symfony/console": "dev-master" + }, + "require-dev": { + "behat/behat": "dev-master", + "phpspec/phpspec": "dev-master" + }, + "bin": [ + "bin/poser" + ], + "type": "lib", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "PUGX\\Poser\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Giulio De Donato", + "email": "liuggio@gmail.com", + "homepage": "http://www.welcometothebundle.com" + }, + { + "name": "PUGX Community", + "homepage": "https://github.com/PUGX/badge-poser/contributors" + }, + { + "name": "Shields Community", + "homepage": "https://github.com/badges/poser/contributors" + } + ], + "description": "Poser, add badges on your readme..", + "homepage": "https://github.com/PUGX", + "keywords": [ + "badge", + "composer", + "packagist", + "pin" + ], + "time": "2014-06-29 13:50:45" + }, { "name": "doctrine/annotations", - "version": "v1.1.2", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/doctrine/annotations.git", - "reference": "40db0c96985aab2822edbc4848b3bd2429e02670" + "reference": "3f58ce08b67f04b228f9fe93242757e0376f719c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/40db0c96985aab2822edbc4848b3bd2429e02670", - "reference": "40db0c96985aab2822edbc4848b3bd2429e02670", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/3f58ce08b67f04b228f9fe93242757e0376f719c", + "reference": "3f58ce08b67f04b228f9fe93242757e0376f719c", "shasum": "" }, "require": { @@ -24,12 +89,13 @@ "php": ">=5.3.2" }, "require-dev": { - "doctrine/cache": "1.*" + "doctrine/cache": "1.*", + "phpunit/phpunit": "4.*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.2.x-dev" } }, "autoload": { @@ -43,7 +109,7 @@ ], "authors": [ { - "name": "Jonathan Wage", + "name": "Jonathan H. Wage", "email": "jonwage@gmail.com", "homepage": "http://www.jwage.com/", "role": "Creator" @@ -64,7 +130,7 @@ { "name": "Johannes Schmitt", "email": "schmittjoh@gmail.com", - "homepage": "http://jmsyst.com", + "homepage": "https://github.com/schmittjoh", "role": "Developer of wrapped JMSSerializerBundle" } ], @@ -75,20 +141,20 @@ "docblock", "parser" ], - "time": "2013-06-16 21:33:03" + "time": "2014-05-20 13:29:32" }, { "name": "doctrine/cache", - "version": "v1.3.0", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/doctrine/cache.git", - "reference": "e16d7adf45664a50fa86f515b6d5e7f670130449" + "reference": "bb9b55b17bed5923c9446c8158a92623d39480c6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/cache/zipball/e16d7adf45664a50fa86f515b6d5e7f670130449", - "reference": "e16d7adf45664a50fa86f515b6d5e7f670130449", + "url": "https://api.github.com/repos/doctrine/cache/zipball/bb9b55b17bed5923c9446c8158a92623d39480c6", + "reference": "bb9b55b17bed5923c9446c8158a92623d39480c6", "shasum": "" }, "require": { @@ -104,7 +170,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.4.x-dev" } }, "autoload": { @@ -118,7 +184,7 @@ ], "authors": [ { - "name": "Jonathan H. Wage", + "name": "Jonathan Wage", "email": "jonwage@gmail.com", "homepage": "http://www.jwage.com/", "role": "Creator" @@ -139,7 +205,7 @@ { "name": "Johannes Schmitt", "email": "schmittjoh@gmail.com", - "homepage": "http://jmsyst.com", + "homepage": "https://github.com/schmittjoh", "role": "Developer of wrapped JMSSerializerBundle" } ], @@ -149,25 +215,28 @@ "cache", "caching" ], - "time": "2013-10-25 19:04:14" + "time": "2014-03-27 11:06:41" }, { "name": "doctrine/collections", - "version": "v1.2", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/doctrine/collections.git", - "reference": "b99c5c46c87126201899afe88ec490a25eedd6a2" + "reference": "bbe35735af4a826c1f86b04f2fd885ff5fc0f82b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/collections/zipball/b99c5c46c87126201899afe88ec490a25eedd6a2", - "reference": "b99c5c46c87126201899afe88ec490a25eedd6a2", + "url": "https://api.github.com/repos/doctrine/collections/zipball/bbe35735af4a826c1f86b04f2fd885ff5fc0f82b", + "reference": "bbe35735af4a826c1f86b04f2fd885ff5fc0f82b", "shasum": "" }, "require": { "php": ">=5.3.2" }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, "type": "library", "extra": { "branch-alias": { @@ -185,7 +254,7 @@ ], "authors": [ { - "name": "Jonathan Wage", + "name": "Jonathan H. Wage", "email": "jonwage@gmail.com", "homepage": "http://www.jwage.com/", "role": "Creator" @@ -206,7 +275,7 @@ { "name": "Johannes Schmitt", "email": "schmittjoh@gmail.com", - "homepage": "http://jmsyst.com", + "homepage": "https://github.com/schmittjoh", "role": "Developer of wrapped JMSSerializerBundle" } ], @@ -217,20 +286,20 @@ "collections", "iterator" ], - "time": "2014-02-03 23:07:43" + "time": "2014-06-17 17:31:49" }, { "name": "doctrine/common", - "version": "v2.4.1", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/doctrine/common.git", - "reference": "ceb18cf9b0230f3ea208b6238130fd415abda0a7" + "reference": "434c364b6a8780c16769b60fcc56e61e6bac766f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/common/zipball/ceb18cf9b0230f3ea208b6238130fd415abda0a7", - "reference": "ceb18cf9b0230f3ea208b6238130fd415abda0a7", + "url": "https://api.github.com/repos/doctrine/common/zipball/434c364b6a8780c16769b60fcc56e61e6bac766f", + "reference": "434c364b6a8780c16769b60fcc56e61e6bac766f", "shasum": "" }, "require": { @@ -241,10 +310,13 @@ "doctrine/lexer": "1.*", "php": ">=5.3.2" }, + "require-dev": { + "phpunit/phpunit": "~3.7" + }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.4.x-dev" + "dev-master": "2.5.x-dev" } }, "autoload": { @@ -292,26 +364,34 @@ "persistence", "spl" ], - "time": "2013-09-07 10:20:34" + "time": "2014-03-19 13:50:21" }, { "name": "doctrine/inflector", - "version": "v1.0", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/doctrine/inflector.git", - "reference": "54b8333d2a5682afdc690060c1cf384ba9f47f08" + "reference": "64de2fe36d578c5d5f3807ac7984547bbba5f7c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/inflector/zipball/54b8333d2a5682afdc690060c1cf384ba9f47f08", - "reference": "54b8333d2a5682afdc690060c1cf384ba9f47f08", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/64de2fe36d578c5d5f3807ac7984547bbba5f7c5", + "reference": "64de2fe36d578c5d5f3807ac7984547bbba5f7c5", "shasum": "" }, "require": { "php": ">=5.3.2" }, + "require-dev": { + "phpunit/phpunit": "4.*" + }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, "autoload": { "psr-0": { "Doctrine\\Common\\Inflector\\": "lib/" @@ -352,30 +432,35 @@ "homepage": "http://www.doctrine-project.org", "keywords": [ "inflection", - "pluarlize", - "singuarlize", + "pluralize", + "singularize", "string" ], - "time": "2013-01-10 21:49:15" + "time": "2014-04-23 12:36:11" }, { "name": "doctrine/lexer", - "version": "v1.0", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/doctrine/lexer.git", - "reference": "2f708a85bb3aab5d99dab8be435abd73e0b18acb" + "reference": "db77c80d33d72e33a62b80581e9d150af85de556" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/2f708a85bb3aab5d99dab8be435abd73e0b18acb", - "reference": "2f708a85bb3aab5d99dab8be435abd73e0b18acb", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/db77c80d33d72e33a62b80581e9d150af85de556", + "reference": "db77c80d33d72e33a62b80581e9d150af85de556", "shasum": "" }, "require": { "php": ">=5.3.2" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, "autoload": { "psr-0": { "Doctrine\\Common\\Lexer\\": "lib/" @@ -408,11 +493,11 @@ "lexer", "parser" ], - "time": "2013-01-12 18:59:04" + "time": "2014-06-11 23:09:27" }, { "name": "guzzle/cache", - "version": "v3.9.1", + "version": "dev-master", "target-dir": "Guzzle/Cache", "source": { "type": "git", @@ -464,7 +549,7 @@ }, { "name": "guzzle/common", - "version": "v3.9.1", + "version": "dev-master", "target-dir": "Guzzle/Common", "source": { "type": "git", @@ -508,7 +593,7 @@ }, { "name": "guzzle/http", - "version": "v3.9.1", + "version": "dev-master", "target-dir": "Guzzle/Http", "source": { "type": "git", @@ -565,7 +650,7 @@ }, { "name": "guzzle/parser", - "version": "v3.9.1", + "version": "dev-master", "target-dir": "Guzzle/Parser", "source": { "type": "git", @@ -609,7 +694,7 @@ }, { "name": "guzzle/plugin-cache", - "version": "v3.9.1", + "version": "dev-master", "target-dir": "Guzzle/Plugin/Cache", "source": { "type": "git", @@ -659,7 +744,7 @@ }, { "name": "guzzle/stream", - "version": "v3.9.1", + "version": "dev-master", "target-dir": "Guzzle/Stream", "source": { "type": "git", @@ -712,17 +797,17 @@ }, { "name": "incenteev/composer-parameter-handler", - "version": "v2.1.0", + "version": "dev-master", "target-dir": "Incenteev/ParameterHandler", "source": { "type": "git", "url": "https://github.com/Incenteev/ParameterHandler.git", - "reference": "143272a0a09c62616a3c8011fc165a10c6b35241" + "reference": "15b15d8246d501df277dd6e40f5fd3f6e2084c42" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Incenteev/ParameterHandler/zipball/143272a0a09c62616a3c8011fc165a10c6b35241", - "reference": "143272a0a09c62616a3c8011fc165a10c6b35241", + "url": "https://api.github.com/repos/Incenteev/ParameterHandler/zipball/15b15d8246d501df277dd6e40f5fd3f6e2084c42", + "reference": "15b15d8246d501df277dd6e40f5fd3f6e2084c42", "shasum": "" }, "require": { @@ -760,20 +845,20 @@ "keywords": [ "parameters management" ], - "time": "2013-12-07 10:10:39" + "time": "2014-05-02 13:55:31" }, { "name": "knplabs/packagist-api", - "version": "v1.1", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/KnpLabs/packagist-api.git", - "reference": "5d46003cfb1aca37efc84e8a0f1e8ba276a8245e" + "reference": "d29b260c9b9ccf536b0f7f876c879650c0c5d8e5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/KnpLabs/packagist-api/zipball/5d46003cfb1aca37efc84e8a0f1e8ba276a8245e", - "reference": "5d46003cfb1aca37efc84e8a0f1e8ba276a8245e", + "url": "https://api.github.com/repos/KnpLabs/packagist-api/zipball/d29b260c9b9ccf536b0f7f876c879650c0c5d8e5", + "reference": "d29b260c9b9ccf536b0f7f876c879650c0c5d8e5", "shasum": "" }, "require": { @@ -813,20 +898,20 @@ "composer", "packagist" ], - "time": "2013-11-22 09:55:31" + "time": "2014-06-04 09:18:30" }, { "name": "kriswallsmith/assetic", - "version": "v1.1.2", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/kriswallsmith/assetic.git", - "reference": "735cffd3982c6e8cdebe292d5db39d077f65890f" + "reference": "964340e69361802eddf51e8eaa85acbd1c621edf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/kriswallsmith/assetic/zipball/735cffd3982c6e8cdebe292d5db39d077f65890f", - "reference": "735cffd3982c6e8cdebe292d5db39d077f65890f", + "url": "https://api.github.com/repos/kriswallsmith/assetic/zipball/964340e69361802eddf51e8eaa85acbd1c621edf", + "reference": "964340e69361802eddf51e8eaa85acbd1c621edf", "shasum": "" }, "require": { @@ -841,7 +926,9 @@ "leafo/scssphp": "*", "leafo/scssphp-compass": "*", "mrclay/minify": "*", + "patchwork/jsqueeze": "*", "phpunit/phpunit": "~3.7", + "psr/log": "~1.0", "ptachoire/cssembed": "*", "twig/twig": "~1.6" }, @@ -849,13 +936,14 @@ "leafo/lessphp": "Assetic provides the integration with the lessphp LESS compiler", "leafo/scssphp": "Assetic provides the integration with the scssphp SCSS compiler", "leafo/scssphp-compass": "Assetic provides the integration with the SCSS compass plugin", + "patchwork/jsqueeze": "Assetic provides the integration with the JSqueeze JavaScript compressor", "ptachoire/cssembed": "Assetic provides the integration with phpcssembed to embed data uris", "twig/twig": "Assetic provides the integration with the Twig templating engine" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-master": "1.2-dev" } }, "autoload": { @@ -884,20 +972,20 @@ "compression", "minification" ], - "time": "2013-07-19 00:03:27" + "time": "2014-05-05 12:59:42" }, { "name": "monolog/monolog", - "version": "1.9.1", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "65026b610f8c19e61d7242f600530677b0466aac" + "reference": "f84030a0098dd70b149294a252bbdd7f6953e969" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/65026b610f8c19e61d7242f600530677b0466aac", - "reference": "65026b610f8c19e61d7242f600530677b0466aac", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/f84030a0098dd70b149294a252bbdd7f6953e969", + "reference": "f84030a0098dd70b149294a252bbdd7f6953e969", "shasum": "" }, "require": { @@ -925,7 +1013,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.9.x-dev" + "dev-master": "1.10.x-dev" } }, "autoload": { @@ -952,25 +1040,28 @@ "logging", "psr-3" ], - "time": "2014-04-24 13:29:03" + "time": "2014-06-29 10:53:44" }, { "name": "predis/predis", - "version": "v0.8.5", + "version": "0.8.x-dev", "source": { "type": "git", "url": "https://github.com/nrk/predis.git", - "reference": "5f2eea628eb465d866ad2771927d83769c8f956c" + "reference": "8373663486b836813987ab7f0ef03d388e8fc146" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nrk/predis/zipball/5f2eea628eb465d866ad2771927d83769c8f956c", - "reference": "5f2eea628eb465d866ad2771927d83769c8f956c", + "url": "https://api.github.com/repos/nrk/predis/zipball/8373663486b836813987ab7f0ef03d388e8fc146", + "reference": "8373663486b836813987ab7f0ef03d388e8fc146", "shasum": "" }, "require": { "php": ">=5.3.2" }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, "suggest": { "ext-curl": "Allows access to Webdis when paired with phpiredis", "ext-phpiredis": "Allows faster serialization and deserialization of the Redis protocol" @@ -999,23 +1090,28 @@ "predis", "redis" ], - "time": "2014-01-16 14:10:29" + "time": "2014-06-23 12:25:30" }, { "name": "psr/log", - "version": "1.0.0", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b" + "reference": "a78d6504ff5d4367497785ab2ade91db3a9fbe11" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b", - "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b", + "url": "https://api.github.com/repos/php-fig/log/zipball/a78d6504ff5d4367497785ab2ade91db3a9fbe11", + "reference": "a78d6504ff5d4367497785ab2ade91db3a9fbe11", "shasum": "" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, "autoload": { "psr-0": { "Psr\\Log\\": "" @@ -1037,7 +1133,7 @@ "psr", "psr-3" ], - "time": "2012-12-21 11:40:51" + "time": "2014-01-18 15:33:09" }, { "name": "sensio/distribution-bundle", @@ -1089,17 +1185,17 @@ }, { "name": "sensio/framework-extra-bundle", - "version": "v2.3.4", + "version": "2.3.x-dev", "target-dir": "Sensio/Bundle/FrameworkExtraBundle", "source": { "type": "git", "url": "https://github.com/sensiolabs/SensioFrameworkExtraBundle.git", - "reference": "cce05719041d952bbec856789ca18646a1891d03" + "reference": "f9e4c9794fb2624bcdee302109896d990bacddec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sensiolabs/SensioFrameworkExtraBundle/zipball/cce05719041d952bbec856789ca18646a1891d03", - "reference": "cce05719041d952bbec856789ca18646a1891d03", + "url": "https://api.github.com/repos/sensiolabs/SensioFrameworkExtraBundle/zipball/f9e4c9794fb2624bcdee302109896d990bacddec", + "reference": "f9e4c9794fb2624bcdee302109896d990bacddec", "shasum": "" }, "require": { @@ -1134,21 +1230,21 @@ "annotations", "controllers" ], - "time": "2013-07-24 08:49:53" + "time": "2014-03-14 07:43:23" }, { "name": "snc/redis-bundle", - "version": "1.1.8", + "version": "dev-master", "target-dir": "Snc/RedisBundle", "source": { "type": "git", "url": "https://github.com/snc/SncRedisBundle.git", - "reference": "52549acbfa4dc3f1bd5e23aad3c92de6de4258d1" + "reference": "43f8bb8109b6c419b5e8be4b76369e41a9a6070c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/snc/SncRedisBundle/zipball/52549acbfa4dc3f1bd5e23aad3c92de6de4258d1", - "reference": "52549acbfa4dc3f1bd5e23aad3c92de6de4258d1", + "url": "https://api.github.com/repos/snc/SncRedisBundle/zipball/43f8bb8109b6c419b5e8be4b76369e41a9a6070c", + "reference": "43f8bb8109b6c419b5e8be4b76369e41a9a6070c", "shasum": "" }, "require": { @@ -1198,25 +1294,24 @@ "redis", "symfony" ], - "time": "2014-02-01 09:46:23" + "time": "2014-06-26 07:48:05" }, { "name": "symfony/assetic-bundle", - "version": "v2.3.0", - "target-dir": "Symfony/Bundle/AsseticBundle", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/symfony/AsseticBundle.git", - "reference": "146dd3cb46b302bd471560471c6aaa930483dac1" + "reference": "08dcf50de5dd2411dcb8732fa96e0f95ff16628e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/AsseticBundle/zipball/146dd3cb46b302bd471560471c6aaa930483dac1", - "reference": "146dd3cb46b302bd471560471c6aaa930483dac1", + "url": "https://api.github.com/repos/symfony/AsseticBundle/zipball/08dcf50de5dd2411dcb8732fa96e0f95ff16628e", + "reference": "08dcf50de5dd2411dcb8732fa96e0f95ff16628e", "shasum": "" }, "require": { - "kriswallsmith/assetic": "~1.1", + "kriswallsmith/assetic": "~1.2", "php": ">=5.3.0", "symfony/framework-bundle": "~2.1" }, @@ -1230,17 +1325,18 @@ "symfony/yaml": "~2.1" }, "suggest": { + "kriswallsmith/spork": "v0.2", "symfony/twig-bundle": "~2.1" }, "type": "symfony-bundle", "extra": { "branch-alias": { - "dev-master": "2.1.x-dev" + "dev-master": "2.4-dev" } }, "autoload": { - "psr-0": { - "Symfony\\Bundle\\AsseticBundle": "" + "psr-4": { + "Symfony\\Bundle\\AsseticBundle\\": "" } }, "notification-url": "https://packagist.org/downloads/", @@ -1261,11 +1357,11 @@ "compression", "minification" ], - "time": "2013-05-16 05:32:23" + "time": "2014-06-21 16:10:11" }, { "name": "symfony/icu", - "version": "v1.2.1", + "version": "1.2.x-dev", "target-dir": "Symfony/Component/Icu", "source": { "type": "git", @@ -1313,21 +1409,20 @@ }, { "name": "symfony/monolog-bundle", - "version": "v2.5.1", - "target-dir": "Symfony/Bundle/MonologBundle", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/symfony/MonologBundle.git", - "reference": "71ad844ac29401f86619f9d643393265451e858b" + "reference": "b8112a131822e6b48e648ab7c630a8977aaf334e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/MonologBundle/zipball/71ad844ac29401f86619f9d643393265451e858b", - "reference": "71ad844ac29401f86619f9d643393265451e858b", + "url": "https://api.github.com/repos/symfony/MonologBundle/zipball/b8112a131822e6b48e648ab7c630a8977aaf334e", + "reference": "b8112a131822e6b48e648ab7c630a8977aaf334e", "shasum": "" }, "require": { - "monolog/monolog": "~1.6", + "monolog/monolog": "~1.8", "php": ">=5.3.2", "symfony/config": "~2.3", "symfony/dependency-injection": "~2.3", @@ -1341,12 +1436,12 @@ "type": "symfony-bundle", "extra": { "branch-alias": { - "dev-master": "2.5.x-dev" + "dev-master": "2.6.x-dev" } }, "autoload": { - "psr-0": { - "Symfony\\Bundle\\MonologBundle": "" + "psr-4": { + "Symfony\\Bundle\\MonologBundle\\": "" } }, "notification-url": "https://packagist.org/downloads/", @@ -1371,20 +1466,20 @@ "log", "logging" ], - "time": "2014-02-19 14:49:26" + "time": "2014-06-21 16:10:19" }, { "name": "symfony/symfony", - "version": "v2.4.4", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/symfony/symfony.git", - "reference": "4697c33cdfb520dcf83fd6e4f7864fa26ddaebea" + "reference": "279b5e5b986088ec2bf2d672f65c7bcd62fca0cb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/symfony/zipball/4697c33cdfb520dcf83fd6e4f7864fa26ddaebea", - "reference": "4697c33cdfb520dcf83fd6e4f7864fa26ddaebea", + "url": "https://api.github.com/repos/symfony/symfony/zipball/279b5e5b986088ec2bf2d672f65c7bcd62fca0cb", + "reference": "279b5e5b986088ec2bf2d672f65c7bcd62fca0cb", "shasum": "" }, "require": { @@ -1392,7 +1487,7 @@ "php": ">=5.3.3", "psr/log": "~1.0", "symfony/icu": "~1.0", - "twig/twig": "~1.11" + "twig/twig": "~1.12" }, "replace": { "symfony/browser-kit": "self.version", @@ -1441,7 +1536,9 @@ "require-dev": { "doctrine/data-fixtures": "1.0.*", "doctrine/dbal": "~2.2", + "doctrine/doctrine-bundle": "~1.2", "doctrine/orm": "~2.2,>=2.2.3", + "egulias/email-validator": "1.1.0", "ircmaxell/password-compat": "1.0.*", "monolog/monolog": "~1.3", "ocramius/proxy-manager": ">=0.3.1,<0.6-dev", @@ -1450,7 +1547,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.4-dev" + "dev-master": "2.6-dev" } }, "autoload": { @@ -1486,24 +1583,24 @@ "keywords": [ "framework" ], - "time": "2014-04-27 13:39:18" + "time": "2014-06-28 07:15:08" }, { "name": "twig/extensions", - "version": "v1.0.1", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/fabpot/Twig-extensions.git", - "reference": "f91a82ec225e5bb108e01a0f93c9be04f84dcfa0" + "reference": "502303198afc1ec0bcc061c6f3a0926f7eb685e3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fabpot/Twig-extensions/zipball/f91a82ec225e5bb108e01a0f93c9be04f84dcfa0", - "reference": "f91a82ec225e5bb108e01a0f93c9be04f84dcfa0", + "url": "https://api.github.com/repos/fabpot/Twig-extensions/zipball/502303198afc1ec0bcc061c6f3a0926f7eb685e3", + "reference": "502303198afc1ec0bcc061c6f3a0926f7eb685e3", "shasum": "" }, "require": { - "twig/twig": "~1.0" + "twig/twig": "~1.12" }, "type": "library", "extra": { @@ -1535,20 +1632,20 @@ "i18n", "text" ], - "time": "2013-10-18 19:37:15" + "time": "2014-03-01 02:53:07" }, { "name": "twig/twig", - "version": "v1.15.1", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/fabpot/Twig.git", - "reference": "1fb5784662f438d7d96a541e305e28b812e2eeed" + "reference": "96336aba609af06e8722ddc17451ce93d70b54e1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fabpot/Twig/zipball/1fb5784662f438d7d96a541e305e28b812e2eeed", - "reference": "1fb5784662f438d7d96a541e305e28b812e2eeed", + "url": "https://api.github.com/repos/fabpot/Twig/zipball/96336aba609af06e8722ddc17451ce93d70b54e1", + "reference": "96336aba609af06e8722ddc17451ce93d70b54e1", "shasum": "" }, "require": { @@ -1557,7 +1654,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.15-dev" + "dev-master": "1.16-dev" } }, "autoload": { @@ -1592,13 +1689,13 @@ "keywords": [ "templating" ], - "time": "2014-02-13 10:19:29" + "time": "2014-06-20 07:26:46" } ], "packages-dev": [ { "name": "guzzle/plugin-mock", - "version": "v3.9.1", + "version": "dev-master", "target-dir": "Guzzle/Plugin/Mock", "source": { "type": "git", @@ -1646,18 +1743,131 @@ ], "time": "2014-02-25 04:11:22" }, + { + "name": "ocramius/instantiator", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/Ocramius/Instantiator.git", + "reference": "cc754c2289ffd4483c319f6ed6ee88ce21676f64" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Ocramius/Instantiator/zipball/cc754c2289ffd4483c319f6ed6ee88ce21676f64", + "reference": "cc754c2289ffd4483c319f6ed6ee88ce21676f64", + "shasum": "" + }, + "require": { + "ocramius/lazy-map": "1.0.*", + "php": "~5.3" + }, + "require-dev": { + "athletic/athletic": "~0.1.8", + "ext-phar": "*", + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "2.0.*@ALPHA" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Instantiator\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/", + "role": "Developer" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://github.com/Ocramius/Instantiator", + "keywords": [ + "constructor", + "instantiate" + ], + "time": "2014-06-15 11:44:46" + }, + { + "name": "ocramius/lazy-map", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/Ocramius/LazyMap.git", + "reference": "5c77102e225d225ae2d74d5f2cc488527834b821" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Ocramius/LazyMap/zipball/5c77102e225d225ae2d74d5f2cc488527834b821", + "reference": "5c77102e225d225ae2d74d5f2cc488527834b821", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "athletic/athletic": "~0.1.7", + "phpmd/phpmd": "1.5.*", + "phpunit/phpunit": ">=3.7", + "satooshi/php-coveralls": "~0.6", + "squizlabs/php_codesniffer": "1.4.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "LazyMap\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.io/", + "role": "Developer" + } + ], + "description": "A library that provides lazy instantiation logic for a map of objects", + "homepage": "https://github.com/Ocramius/LazyMap", + "keywords": [ + "lazy", + "lazy instantiation", + "lazy loading", + "map", + "service location" + ], + "time": "2014-05-01 22:15:23" + }, { "name": "phake/phake", - "version": "v1.0.5", + "version": "1.0.x-dev", "source": { "type": "git", "url": "https://github.com/mlively/Phake.git", - "reference": "14e4788698e4a21774220c22f3dcaa2e97648b61" + "reference": "76fc7fd9d81d3b43cb65a099dfd2972270070e47" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mlively/Phake/zipball/14e4788698e4a21774220c22f3dcaa2e97648b61", - "reference": "14e4788698e4a21774220c22f3dcaa2e97648b61", + "url": "https://api.github.com/repos/mlively/Phake/zipball/76fc7fd9d81d3b43cb65a099dfd2972270070e47", + "reference": "76fc7fd9d81d3b43cb65a099dfd2972270070e47", "shasum": "" }, "require": { @@ -1694,20 +1904,20 @@ "mock", "testing" ], - "time": "2014-04-16 14:49:56" + "time": "2014-04-19 22:17:47" }, { "name": "phpunit/php-code-coverage", - "version": "2.0.6", + "version": "2.0.x-dev", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "bccecf50645068b44f49a84009e2a0499a500b99" + "reference": "be0b2d05c9a56cfd7537d8055afe514dc513b2f9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/bccecf50645068b44f49a84009e2a0499a500b99", - "reference": "bccecf50645068b44f49a84009e2a0499a500b99", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/be0b2d05c9a56cfd7537d8055afe514dc513b2f9", + "reference": "be0b2d05c9a56cfd7537d8055afe514dc513b2f9", "shasum": "" }, "require": { @@ -1759,7 +1969,7 @@ "testing", "xunit" ], - "time": "2014-04-30 09:01:21" + "time": "2014-06-29 08:50:33" }, { "name": "phpunit/php-file-iterator", @@ -1896,16 +2106,16 @@ }, { "name": "phpunit/php-token-stream", - "version": "1.2.2", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "ad4e1e23ae01b483c16f600ff1bebec184588e32" + "reference": "a0802561692c3b2bb0ed972f7ffafbfab068e580" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/ad4e1e23ae01b483c16f600ff1bebec184588e32", - "reference": "ad4e1e23ae01b483c16f600ff1bebec184588e32", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/a0802561692c3b2bb0ed972f7ffafbfab068e580", + "reference": "a0802561692c3b2bb0ed972f7ffafbfab068e580", "shasum": "" }, "require": { @@ -1942,20 +2152,20 @@ "keywords": [ "tokenizer" ], - "time": "2014-03-03 05:10:30" + "time": "2014-06-26 07:15:38" }, { "name": "phpunit/phpunit", - "version": "4.1.0", + "version": "4.1.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "efb1b1334605594417a3bd466477772d06d460a8" + "reference": "939cb801b3b2aa253aedd0b279f40bb8f35cec91" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/efb1b1334605594417a3bd466477772d06d460a8", - "reference": "efb1b1334605594417a3bd466477772d06d460a8", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/939cb801b3b2aa253aedd0b279f40bb8f35cec91", + "reference": "939cb801b3b2aa253aedd0b279f40bb8f35cec91", "shasum": "" }, "require": { @@ -2016,28 +2226,29 @@ "testing", "xunit" ], - "time": "2014-05-02 07:13:40" + "time": "2014-06-11 14:15:47" }, { "name": "phpunit/phpunit-mock-objects", - "version": "2.1.0", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "da0eb04d8ee95ec2898187e407e519c118d3d27c" + "reference": "215e10f6355e648faa786c0ba9093d132b30e56b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/da0eb04d8ee95ec2898187e407e519c118d3d27c", - "reference": "da0eb04d8ee95ec2898187e407e519c118d3d27c", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/215e10f6355e648faa786c0ba9093d132b30e56b", + "reference": "215e10f6355e648faa786c0ba9093d132b30e56b", "shasum": "" }, "require": { + "ocramius/instantiator": "~1.0", "php": ">=5.3.3", "phpunit/php-text-template": "~1.2" }, "require-dev": { - "phpunit/phpunit": "~4.1" + "phpunit/phpunit": "4.3.*@dev" }, "suggest": { "ext-soap": "*" @@ -2045,7 +2256,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1.x-dev" + "dev-master": "2.3.x-dev" } }, "autoload": { @@ -2073,20 +2284,20 @@ "mock", "xunit" ], - "time": "2014-05-02 07:04:11" + "time": "2014-06-28 11:28:27" }, { "name": "sebastian/comparator", - "version": "1.0.0", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "f7069ee51fa9fb6c038e16a9d0e3439f5449dcf2" + "reference": "e54a01c0da1b87db3c5a3c4c5277ddf331da4aef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/f7069ee51fa9fb6c038e16a9d0e3439f5449dcf2", - "reference": "f7069ee51fa9fb6c038e16a9d0e3439f5449dcf2", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/e54a01c0da1b87db3c5a3c4c5277ddf331da4aef", + "reference": "e54a01c0da1b87db3c5a3c4c5277ddf331da4aef", "shasum": "" }, "require": { @@ -2138,20 +2349,20 @@ "compare", "equality" ], - "time": "2014-05-02 07:05:58" + "time": "2014-05-11 23:00:21" }, { "name": "sebastian/diff", - "version": "1.1.0", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "1e091702a5a38e6b4c1ba9ca816e3dd343df2e2d" + "reference": "ac84cfdec593945f36f24074d6ea17d296e86f76" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/1e091702a5a38e6b4c1ba9ca816e3dd343df2e2d", - "reference": "1e091702a5a38e6b4c1ba9ca816e3dd343df2e2d", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/ac84cfdec593945f36f24074d6ea17d296e86f76", + "reference": "ac84cfdec593945f36f24074d6ea17d296e86f76", "shasum": "" }, "require": { @@ -2188,27 +2399,27 @@ "keywords": [ "diff" ], - "time": "2013-08-03 16:46:33" + "time": "2014-05-12 05:21:40" }, { "name": "sebastian/environment", - "version": "1.0.0", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "79517609ec01139cd7e9fded0dd7ce08c952ef6a" + "reference": "10c7467da0622f7848cc5cadc0828c3359254df4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/79517609ec01139cd7e9fded0dd7ce08c952ef6a", - "reference": "79517609ec01139cd7e9fded0dd7ce08c952ef6a", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/10c7467da0622f7848cc5cadc0828c3359254df4", + "reference": "10c7467da0622f7848cc5cadc0828c3359254df4", "shasum": "" }, "require": { "php": ">=5.3.3" }, "require-dev": { - "phpunit/phpunit": "4.0.*@dev" + "phpunit/phpunit": "~4.0" }, "type": "library", "extra": { @@ -2239,27 +2450,27 @@ "environment", "hhvm" ], - "time": "2014-02-18 16:17:19" + "time": "2014-05-04 17:56:05" }, { "name": "sebastian/exporter", - "version": "1.0.1", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "1f9a98e6f5dfe0524cb8c6166f7c82f3e9ae1529" + "reference": "eb54a69388e5b7ea48561a65588f067fdda0c886" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/1f9a98e6f5dfe0524cb8c6166f7c82f3e9ae1529", - "reference": "1f9a98e6f5dfe0524cb8c6166f7c82f3e9ae1529", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/eb54a69388e5b7ea48561a65588f067fdda0c886", + "reference": "eb54a69388e5b7ea48561a65588f067fdda0c886", "shasum": "" }, "require": { "php": ">=5.3.3" }, "require-dev": { - "phpunit/phpunit": "4.0.*@dev" + "phpunit/phpunit": "~4.0" }, "type": "library", "extra": { @@ -2292,7 +2503,8 @@ }, { "name": "Adam Harvey", - "email": "aharvey@php.net" + "email": "aharvey@php.net", + "role": "Lead" }, { "name": "Bernhard Schussek", @@ -2305,7 +2517,7 @@ "export", "exporter" ], - "time": "2014-02-16 08:26:31" + "time": "2014-05-05 08:31:02" }, { "name": "sebastian/version", @@ -2346,8 +2558,9 @@ "aliases": [ ], - "minimum-stability": "stable", + "minimum-stability": "dev", "stability-flags": { + "badges/poser": 20, "phpunit/phpunit": 0 }, "platform": { diff --git a/src/PUGX/Badge/Image/Factory/SvgImageFactory.php b/src/PUGX/Badge/Image/Factory/PoserImageFactory.php similarity index 61% rename from src/PUGX/Badge/Image/Factory/SvgImageFactory.php rename to src/PUGX/Badge/Image/Factory/PoserImageFactory.php index 8f811804..5dcf1a29 100644 --- a/src/PUGX/Badge/Image/Factory/SvgImageFactory.php +++ b/src/PUGX/Badge/Image/Factory/PoserImageFactory.php @@ -11,36 +11,37 @@ namespace PUGX\Badge\Image\Factory; -use PUGX\Badge\Image\Generator\SvgShieldGeneratorInterface; -use PUGX\Badge\Image\Image; + use PUGX\Badge\Image\ImageFactoryInterface; +use PUGX\Badge\Image\Image; +use PUGX\Poser\Poser; /** - * Class SvgImageFactory + * Class PoserImageFactory * * @author Claudio D'Alicandro */ -class SvgImageFactory implements ImageFactoryInterface +class PoserImageFactory implements ImageFactoryInterface { /** * @var array $definedColors */ private static $definedColors = array( self::DOWNLOADS => 'blue', - self::STABLE => '#28a3df', - self::UNSTABLE => '#e68718', + self::STABLE => '28a3df', + self::UNSTABLE => 'e68718', self::ERROR => 'red', - self::LICENSE => '#428F7E' + self::LICENSE => '428F7E' ); /** - * @var SvgShieldGeneratorInterface $shieldGenerator + * @var Poser $shieldGenerator */ private $shieldGenerator; - public function __construct(SvgShieldGeneratorInterface $svgStringGenerator) + public function __construct(Poser $poser) { - $this->shieldGenerator = $svgStringGenerator; + $this->shieldGenerator = $poser; } /** @@ -48,11 +49,11 @@ public function __construct(SvgShieldGeneratorInterface $svgStringGenerator) * * @param string $value * - * @return \PUGX\Badge\Image\ImageInterface + * @return \PUGX\Badge\Image\Image */ public function createDownloadsImage($value) { - $shield = $this->generateShield(self::DOWNLOADS, $value, self::$definedColors[self::DOWNLOADS]); + $shield = $this->generate(self::DOWNLOADS, $value, self::$definedColors[self::DOWNLOADS]); return Image::createFromString($shield); } @@ -62,11 +63,11 @@ public function createDownloadsImage($value) * * @param string $value * - * @return \PUGX\Badge\Image\ImageInterface + * @return \PUGX\Badge\Image\Image */ public function createStableNoImage($value) { - $shield = $this->generateShield(self::STABLE, $value, self::$definedColors[self::STABLE]); + $shield = $this->generate(self::STABLE, $value, self::$definedColors[self::STABLE]); return Image::createFromString($shield); } @@ -80,7 +81,7 @@ public function createStableNoImage($value) */ public function createStableImage($value) { - $shield = $this->generateShield(self::STABLE, $value, self::$definedColors[self::STABLE]); + $shield = $this->generate(self::STABLE, $value, self::$definedColors[self::STABLE]); return Image::createFromString($shield); } @@ -94,7 +95,7 @@ public function createStableImage($value) */ public function createUnstableImage($value = '@dev') { - $shield = $this->generateShield(self::UNSTABLE, $value, self::$definedColors[self::UNSTABLE]); + $shield = $this->generate(self::UNSTABLE, $value, self::$definedColors[self::UNSTABLE]); return Image::createFromString($shield); } @@ -104,11 +105,11 @@ public function createUnstableImage($value = '@dev') * * @param string $value * - * @return \PUGX\Badge\Image\ImageInterface + * @return \PUGX\Badge\Image\Image */ public function createErrorImage($value) { - $shield = $this->generateShield(self::ERROR, $value, self::$definedColors[self::ERROR]); + $shield = $this->generate(self::ERROR, $value, self::$definedColors[self::ERROR]); return Image::createFromString($shield); } @@ -118,11 +119,11 @@ public function createErrorImage($value) * * @param string $value * - * @return \PUGX\Badge\Image\ImageInterface + * @return \PUGX\Badge\Image\Image */ public function createLicenseImage($value) { - $shield = $this->generateShield(self::LICENSE, $value, self::$definedColors[self::LICENSE]); + $shield = $this->generate(self::LICENSE, $value, self::$definedColors[self::LICENSE]); return Image::createFromString($shield); } @@ -134,8 +135,8 @@ public function createLicenseImage($value) * * @return string */ - private function generateShield($vendor, $value, $color) + private function generate($vendor, $value, $color) { - return $this->shieldGenerator->generateShield($vendor, $value, $color); + return $this->shieldGenerator->generate($vendor, $value, $color, 'svg'); } } diff --git a/src/PUGX/Badge/Image/Factory/ShieldIOFactory.php b/src/PUGX/Badge/Image/Factory/ShieldIOFactory.php index 47157a4c..4e493788 100644 --- a/src/PUGX/Badge/Image/Factory/ShieldIOFactory.php +++ b/src/PUGX/Badge/Image/Factory/ShieldIOFactory.php @@ -69,13 +69,13 @@ public function __construct(ClientInterface $httpClient, * * @param string $value * - * @return \PUGX\Badge\Image\ImageInterface + * @return \PUGX\Badge\Image\Image */ public function createDownloadsImage($value) { $response = $this->fetchResponse(self::DOWNLOADS, $value, self::$definedColors[self::DOWNLOADS]); - return Image::createFromResponse($response); + return Image::createFromString($response->getBody(true)); } /** @@ -83,13 +83,13 @@ public function createDownloadsImage($value) * * @param string $value * - * @return \PUGX\Badge\Image\ImageInterface + * @return \PUGX\Badge\Image\Image */ public function createStableNoImage($value) { $response = $this->fetchResponse(self::STABLE, $value, self::$definedColors[self::STABLE]); - return Image::createFromResponse($response); + return Image::createFromString($response->getBody(true)); } /** @@ -103,7 +103,7 @@ public function createStableImage($value) { $response = $this->fetchResponse(self::STABLE, $value, self::$definedColors[self::STABLE]); - return Image::createFromResponse($response); + return Image::createFromString($response->getBody(true)); } /** @@ -117,7 +117,7 @@ public function createUnstableImage($value = '@dev') { $response = $this->fetchResponse(self::UNSTABLE, $value, self::$definedColors[self::UNSTABLE]); - return Image::createFromResponse($response); + return Image::createFromString($response->getBody(true)); } /** @@ -125,13 +125,13 @@ public function createUnstableImage($value = '@dev') * * @param string $value * - * @return \PUGX\Badge\Image\ImageInterface + * @return \PUGX\Badge\Image\Image */ public function createErrorImage($value) { $response = $this->fetchResponse(self::ERROR, $value, self::$definedColors[self::ERROR]); - return Image::createFromResponse($response); + return Image::createFromString($response->getBody(true)); } /** @@ -139,13 +139,13 @@ public function createErrorImage($value) * * @param string $value * - * @return \PUGX\Badge\Image\ImageInterface + * @return \PUGX\Badge\Image\Image */ public function createLicenseImage($value) { $response = $this->fetchResponse(self::LICENSE, $value, self::$definedColors[self::LICENSE]); - return Image::createFromResponse($response); + return Image::createFromString($response->getBody(true)); } /** diff --git a/src/PUGX/Badge/Image/Font/DejaVuSans.ttf b/src/PUGX/Badge/Image/Font/DejaVuSans.ttf deleted file mode 100755 index 2db9bdee..00000000 Binary files a/src/PUGX/Badge/Image/Font/DejaVuSans.ttf and /dev/null differ diff --git a/src/PUGX/Badge/Image/Generator/SvgShieldGenerator.php b/src/PUGX/Badge/Image/Generator/SvgShieldGenerator.php deleted file mode 100644 index 50f86fe2..00000000 --- a/src/PUGX/Badge/Image/Generator/SvgShieldGenerator.php +++ /dev/null @@ -1,110 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace PUGX\Badge\Image\Generator; - -use PUGX\Badge\Image\Template\TemplateEngineInterface; - -/** - * Class SvgShieldGenerator - * - * @author Claudio D'Alicandro - */ -class SvgShieldGenerator implements SvgShieldGeneratorInterface -{ - const STRING_SIZE = 11; - const STRING_FONT = '/../Font/DejaVuSans.ttf'; - const VENDOR_COLOR = '#555'; - const SHIELD_PADDING_EXTERNAL = 6; - const SHIELD_PADDING_INTERNAL = 4; - - private static $colorScheme = array( - "brightgreen" => "#4c1", - "green" => "#97CA00", - "yellow" => "#dfb317", - "yellowgreen" => "#a4a61d", - "orange" => "#fe7d37", - "red" => "#e05d44", - "blue" => "#007ec6", - "grey" => "#555", - "lightgray" => "#9f9f9f" - ); - - /** - * @var TemplateEngineInterface $templateEngine - */ - private $templateEngine; - - /** - * @var string $template - */ - private $template; - - /** - * @param TemplateEngineInterface $templateEngine - * @param string $template - */ - public function __construct(TemplateEngineInterface $templateEngine, $template) - { - $this->templateEngine = $templateEngine; - $this->template = $template; - } - - /** - * @param string $vendor - * @param string $value - * @param string $color - * - * @return string - */ - public function generateShield($vendor, $value, $color) - { - $parameters = array(); - - $color = array_key_exists($color, self::$colorScheme) ? self::$colorScheme[$color] : $color; - - $parameters['vendorWidth'] = $this->stringWidth($vendor); - $parameters['valueWidth'] = $this->stringWidth($value); - $parameters['totalWidth'] = $parameters['valueWidth'] + $parameters['vendorWidth']; - $parameters['vendorColor'] = self::VENDOR_COLOR; - $parameters['valueColor'] = $color; - $parameters['vendor'] = $vendor; - $parameters['value'] = $value; - $parameters['vendorStartPosition'] = round($parameters['vendorWidth'] / 2, 1) + 1; - $parameters['valueStartPosition'] = $parameters['vendorWidth'] + round($parameters['valueWidth'] / 2, 1) - 1; - - return $this->templateEngine->render($this->template, $parameters); - } - - /** - * @param string $text - * @param string $font - * @param int $size - * - * @return int - */ - private function stringWidth($text, $font = self::STRING_FONT, $size = self::STRING_SIZE) - { - $size = $this->convertToPt($size); - $box = imagettfbbox($size, 0, __DIR__ . $font, $text); - return round(abs($box[2] - $box[0]) + self::SHIELD_PADDING_EXTERNAL + self::SHIELD_PADDING_INTERNAL, 1); - } - - /** - * @param int $pixels - * - * @return int - */ - private function convertToPt($pixels) - { - return round($pixels * 0.75, 1); - } -} diff --git a/src/PUGX/Badge/Image/Generator/SvgShieldGeneratorInterface.php b/src/PUGX/Badge/Image/Generator/SvgShieldGeneratorInterface.php deleted file mode 100644 index 16c7648e..00000000 --- a/src/PUGX/Badge/Image/Generator/SvgShieldGeneratorInterface.php +++ /dev/null @@ -1,29 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace PUGX\Badge\Image\Generator; - -/** - * Interface SvgShieldGeneratorInterface - * - * @author Claudio D'Alicandro - */ -interface SvgShieldGeneratorInterface -{ - /** - * @param string $vendor - * @param string $type - * @param string $color - * - * @return string - */ - public function generateShield($vendor, $type, $color); -} diff --git a/src/PUGX/Badge/Image/Image.php b/src/PUGX/Badge/Image/Image.php index 27a81f30..28a80f85 100644 --- a/src/PUGX/Badge/Image/Image.php +++ b/src/PUGX/Badge/Image/Image.php @@ -11,7 +11,6 @@ namespace PUGX\Badge\Image; -use Guzzle\Http\Message\Response; /** * Class Image, an Image value Object @@ -19,7 +18,7 @@ * @author Claudio D'Alicandro * @author Giulio De Donato */ -class Image implements ImageInterface +class Image { /** * @var string $content @@ -42,20 +41,6 @@ public function __toString() return $this->content; } - /** - * Factory method - * - * @param Response $response - * - * @return Image - */ - public static function createFromResponse(Response $response) - { - $content = $response->getBody(true); - - return self::createFromString($content); - } - /** * Factory method * @@ -65,6 +50,7 @@ public static function createFromResponse(Response $response) */ public static function createFromString($content) { + $content = (string) $content; return new self($content); } } diff --git a/src/PUGX/Badge/Image/ImageFactoryInterface.php b/src/PUGX/Badge/Image/ImageFactoryInterface.php index 5963670c..f2d9a6fd 100644 --- a/src/PUGX/Badge/Image/ImageFactoryInterface.php +++ b/src/PUGX/Badge/Image/ImageFactoryInterface.php @@ -38,7 +38,7 @@ public function createDownloadsImage($value); * * @param string $value * - * @return ImageInterface + * @return Image */ public function createStableNoImage($value); @@ -65,7 +65,7 @@ public function createUnstableImage($value = '@dev'); * * @param string $value * - * @return ImageInterface + * @return Image */ public function createErrorImage($value); @@ -74,7 +74,7 @@ public function createErrorImage($value); * * @param string $value * - * @return ImageInterface + * @return Image */ public function createLicenseImage($value); } diff --git a/src/PUGX/Badge/Image/ImageInterface.php b/src/PUGX/Badge/Image/ImageInterface.php deleted file mode 100644 index 1e187e8f..00000000 --- a/src/PUGX/Badge/Image/ImageInterface.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace PUGX\Badge\Image; - -/** - * @author Claudio D'Alicandro - * @author Giulio De Donato - */ -interface ImageInterface -{ - public function __toString(); -} diff --git a/src/PUGX/Badge/Image/Template/TemplateEngineInterface.php b/src/PUGX/Badge/Image/Template/TemplateEngineInterface.php deleted file mode 100644 index eeaffbab..00000000 --- a/src/PUGX/Badge/Image/Template/TemplateEngineInterface.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace PUGX\Badge\Image\Template; - -/** - * Interface TemplateEngineInterface - * - * @author Claudio D'Alicandro - */ -interface TemplateEngineInterface -{ - /** - * @param string $templatePath - * @param array $parameters - * - * @return string - */ - public function render($templatePath, array $parameters); -} diff --git a/src/PUGX/Badge/Image/Tests/Factory/ShieldIOFactoryTest.php b/src/PUGX/Badge/Image/Tests/Factory/ShieldIOFactoryTest.php index 1c49ecae..06c1ca1a 100644 --- a/src/PUGX/Badge/Image/Tests/Factory/ShieldIOFactoryTest.php +++ b/src/PUGX/Badge/Image/Tests/Factory/ShieldIOFactoryTest.php @@ -36,6 +36,6 @@ public function testShouldCreateDownloadsImage() ->will($this->returnValue('http://img.shields.io/badge/downloads-test-blue.svg')); $image = $this->imageCreator->createDownloadsImage('test'); - $this->assertInstanceOf('PUGX\Badge\Image\ImageInterface', $image); + $this->assertInstanceOf('PUGX\Badge\Image\Image', $image); } } diff --git a/src/PUGX/Badge/Image/Tests/Factory/SvgImageFactoryTest.php b/src/PUGX/Badge/Image/Tests/Factory/SvgImageFactoryTest.php index 023744a4..6682c1a0 100644 --- a/src/PUGX/Badge/Image/Tests/Factory/SvgImageFactoryTest.php +++ b/src/PUGX/Badge/Image/Tests/Factory/SvgImageFactoryTest.php @@ -11,32 +11,34 @@ namespace PUGX\Badge\Image\Tests\Factory; -use PUGX\Badge\Image\Factory\SvgImageFactory; +use PUGX\Badge\Image\Factory\PoserImageFactory; /** - * Class SvgImageFactoryTest + * Class PoserImageFactoryTest * * @author Claudio D'Alicandro */ -class SvgImageFactoryTest extends \PHPUnit_Framework_TestCase +class PoserImageFactoryTest extends \PHPUnit_Framework_TestCase { - /** @var SvgImageFactory $imageFactory */ + /** @var PoserImageFactory $imageFactory */ private $imageFactory; public function setUp() { - $shieldGenerator = $this->getMock('\PUGX\Badge\Image\Generator\SvgShieldGeneratorInterface'); + $shieldGenerator = $this->getMockBuilder('\PUGX\Poser\Poser') + ->disableOriginalConstructor() + ->getMock(); $shieldGenerator->expects($this->once()) - ->method('generateShield') + ->method('generate') ->will($this->returnValue('')); - $this->imageFactory = new SvgImageFactory($shieldGenerator); + $this->imageFactory = new PoserImageFactory($shieldGenerator); } public function testShouldCreateDownloadsImage() { $image = $this->imageFactory->createDownloadsImage('test', 'test', 'red'); - $this->assertInstanceOf('PUGX\Badge\Image\ImageInterface', $image); + $this->assertInstanceOf('PUGX\Badge\Image\Image', $image); } } diff --git a/src/PUGX/Badge/Image/Tests/Generator/SvgShieldGeneratorTest.php b/src/PUGX/Badge/Image/Tests/Generator/SvgShieldGeneratorTest.php deleted file mode 100644 index 1cd7eb95..00000000 --- a/src/PUGX/Badge/Image/Tests/Generator/SvgShieldGeneratorTest.php +++ /dev/null @@ -1,88 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace PUGX\Badge\Image\Generator { - // travis fails the calculation of the box size... faked! - function imagettfbbox($size, $angle, $fontfile, $text) { - global $mockImagettfbbox; - - if (isset($mockImagettfbbox) && $mockImagettfbbox != false) { - return $mockImagettfbbox[$text]; - } else { - return call_user_func_array('\imagettfbbox', func_get_args()); - } - } - -} - - -namespace PUGX\Badge\Image\Tests\Generator { - -use PUGX\Badge\Image\Generator\SvgShieldGenerator; -use PUGX\Badge\Image\Generator\SvgShieldGeneratorInterface; - - -/** - * Class SvgShieldGeneratorTest - * - * @author Claudio D'Alicandro - */ -class SvgShieldGeneratorTest extends \PHPUnit_Framework_TestCase -{ - /** @var SvgShieldGeneratorInterface $shieldGenerator */ - public $shieldGenerator; - - /** @var \PHPUnit_Framework_MockObject_MockObject $templateEngine */ - public $templateEngine; - - public function setUp() - { - global $mockImagettfbbox; - $mockImagettfbbox = array( - 'testVendor' => array(-2, 0, 61, 0, 61, -11, -2, -11), - 'testValue' => array(-2, 0, 52, 0, 52, -11, -2, -11) - ); - $this->templateEngine = $this->getMock('\PUGX\Badge\Image\Template\TemplateEngineInterface'); - $this->shieldGenerator = new SvgShieldGenerator($this->templateEngine, 'test'); - } - - /** - * @dataProvider getShieldData - */ - public function testItGenerateAShieldFromVendorValueAndColor($vendor, $value, $color, $expectedParameters) - { - $this->templateEngine->expects($this->once()) - ->method('render') - ->with($this->identicalTo('test'), $this->equalTo($expectedParameters)); - - $this->shieldGenerator->generateShield($vendor, $value, $color); - } - - public function getShieldData() - { - return array( - array( - 'testVendor', 'testValue', 'red', array( - 'vendorWidth' => 73.0, - 'valueWidth' => 64.0, - 'totalWidth' => 137.0, - 'vendorColor' => '#555', - 'valueColor' => '#e05d44', - 'vendor' => 'testVendor', - 'value' => 'testValue', - 'vendorStartPosition' => 37.5, - 'valueStartPosition' => 104.0 - ) - ) - ); - } -} -} \ No newline at end of file diff --git a/src/PUGX/Badge/Package/ApiPackageInterface.php b/src/PUGX/Badge/Package/ApiPackageInterface.php deleted file mode 100644 index 77a93535..00000000 --- a/src/PUGX/Badge/Package/ApiPackageInterface.php +++ /dev/null @@ -1,39 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace PUGX\Badge\Package; - -/** - * Class ApiPackageInterface - * - * @author Giulio De Donato - */ -interface ApiPackageInterface -{ - public function getName(); - - public function getDescription(); - - public function getDownloads(); - - public function getFavers(); - - public function getMaintainers(); - - public function getTime(); - - public function getRepository(); - - public function getType(); - - public function getVersions(); - -} diff --git a/src/PUGX/Badge/Package/Package.php b/src/PUGX/Badge/Package/Package.php index 2f5b2d8c..770046d6 100644 --- a/src/PUGX/Badge/Package/Package.php +++ b/src/PUGX/Badge/Package/Package.php @@ -14,12 +14,13 @@ use Packagist\Api\Result\Package as ApiPackage; /** - * Class Package + * Class Package, decorates the Packagist Package. * * @author Giulio De Donato */ -class Package implements PackageInterface, ApiPackageInterface +class Package { + private static $modifierRegex = '[._-]?(?:(stable|beta|b|RC|alpha|a|patch|pl|p)(?:[.-]?(\d+))?)?([.-]?dev)?'; private $license; private $originalObject; private $latestStableVersion = null; @@ -27,68 +28,153 @@ class Package implements PackageInterface, ApiPackageInterface private $latestStableVersionNormalized = null; private $latestUnstableVersionNormalized = null; - public function setLicense($license) + private function __construct(ApiPackage $apiPackage) { - $this->license = $license; + $this->setOriginalObject($apiPackage); + $this->calculateLatestVersions(); } - public function getLicense() + /** + * Create a new Package decorated with the Api Package. + * + * @param ApiPackage $apiPackage + * + * @return PackageInterface + */ + public static function createFromApi(ApiPackage $apiPackage) { - return $this->license; + $package = new self($apiPackage); + + return $package; } - public function setLatestStableVersion($version) + /** + * Set the latest Stable and the latest Unstable version from a Package. + * + * @return Package + */ + private function calculateLatestVersions() { - $this->latestStableVersion = $version; + $versions = $this->getVersions(); + + foreach ($versions as $name => $version) { + + $currentVersionName = $version->getVersion(); + $versionNormalized = $version->getVersionNormalized(); + + $aliases = $this->getBranchAliases($version); + if (null !== $aliases && array_key_exists($currentVersionName, $aliases)) { + $currentVersionName = $aliases[$currentVersionName]; + } + + $functionName = 'Unstable'; + if ('stable' == self::parseStability($currentVersionName)) { + $functionName = 'Stable'; + } + + if (version_compare($versionNormalized, $this->{'getLatest' . $functionName . 'VersionNormalized'}()) > 0) { + $this->{'setLatest' . $functionName . 'Version'}($currentVersionName); + $this->{'setLatest' . $functionName . 'VersionNormalized'}($versionNormalized); + + $license = $version->getLicense(); + if (is_array($license) && count($license)>0) { + $license = implode(',',$license); + } + $this->setLicense($license); + } + } + + return $this; } - public function getLatestStableVersion() + /** + * Get all the branch aliases. + * + * @param ApiPackage\Version $version + * + * @return null|array + */ + private function getBranchAliases(ApiPackage\Version $version) { - return $this->latestStableVersion; + $extra = $version->getExtra(); + if (null !== $extra + && null !== $extra["branch-alias"] + && is_array($extra["branch-alias"]) + ) { + return $extra["branch-alias"]; + } + + return null; } - public function hasStableVersion() + /** + * Returns the stability of a version. + * + * This function is part of Composer. + * + * (c) Nils Adermann + * Jordi Boggiano + * + * @param string $version + * + * @return string + */ + public static function parseStability($version) { - return isset($this->latestStableVersion); + $version = preg_replace('{#.+$}i', '', $version); + + if ('dev-' === substr($version, 0, 4) || '-dev' === substr($version, -4)) { + return 'dev'; + } + + preg_match('{' . self::$modifierRegex . '$}i', strtolower($version), $match); + if (!empty($match[3])) { + return 'dev'; + } + + if (!empty($match[1])) { + if ('beta' === $match[1] || 'b' === $match[1]) { + return 'beta'; + } + if ('alpha' === $match[1] || 'a' === $match[1]) { + return 'alpha'; + } + if ('rc' === $match[1]) { + return 'RC'; + } + } + + return 'stable'; } - public function setLatestUnstableVersion($version) + public function getLicense() { - $this->latestUnstableVersion = $version; + return $this->license; } - public function getLatestUnstableVersion() + public function getLatestStableVersion() { - return $this->latestUnstableVersion; + return $this->latestStableVersion; } - /** - * @param null $latestStableVersionNormalized - */ - public function setLatestStableVersionNormalized($latestStableVersionNormalized) + public function hasStableVersion() { - $this->latestStableVersionNormalized = $latestStableVersionNormalized; + return isset($this->latestStableVersion); } - /** - * @return null - */ - public function getLatestStableVersionNormalized() + public function getLatestUnstableVersion() { - return $this->latestStableVersionNormalized; + return $this->latestUnstableVersion; } /** - * @param null $latestUnstableVersionNormalized + * @return null */ - public function setLatestUnstableVersionNormalized($latestUnstableVersionNormalized) + public function getLatestStableVersionNormalized() { - $this->latestUnstableVersionNormalized = $latestUnstableVersionNormalized; + return $this->latestStableVersionNormalized; } - /** - * @return null - */ public function getLatestUnstableVersionNormalized() { return $this->latestUnstableVersionNormalized; @@ -99,14 +185,34 @@ public function hasUnstableVersion() return isset($this->latestUnstableVersion); } - public function setOriginalObject(ApiPackage $originalObject) + public function getOriginalObject() { - $this->originalObject = $originalObject; + return $this->originalObject; } - public function getOriginalObject() + private function setLatestUnstableVersionNormalized($latestUnstableVersionNormalized) { - return $this->originalObject; + $this->latestUnstableVersionNormalized = $latestUnstableVersionNormalized; + } + + private function setLicense($license) + { + $this->license = $license; + } + + private function setLatestStableVersion($version) + { + $this->latestStableVersion = $version; + } + + private function setLatestUnstableVersion($version) + { + $this->latestUnstableVersion = $version; + } + + private function setLatestStableVersionNormalized($latestStableVersionNormalized) + { + $this->latestStableVersionNormalized = $latestStableVersionNormalized; } // original object's property @@ -155,4 +261,9 @@ public function getVersions() { return $this->getOriginalObject()->getVersions(); } + + private function setOriginalObject(ApiPackage $originalObject) + { + $this->originalObject = $originalObject; + } } diff --git a/src/PUGX/Badge/Package/PackageInterface.php b/src/PUGX/Badge/Package/PackageInterface.php deleted file mode 100644 index e4f30124..00000000 --- a/src/PUGX/Badge/Package/PackageInterface.php +++ /dev/null @@ -1,34 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace PUGX\Badge\Package; -/** - * Class PackageInterface - * - * @author Giulio De Donato - */ -interface PackageInterface -{ - public function setLatestStableVersion($version); - - public function getLatestStableVersion(); - - public function hasStableVersion(); - - public function setLatestUnstableVersion($version); - - public function getLatestUnstableVersion(); - - public function hasUnstableVersion(); - - public function getName(); - -} diff --git a/src/PUGX/Badge/Package/PackageService.php b/src/PUGX/Badge/Package/PackageService.php index 736a2ef1..6b34a1d2 100644 --- a/src/PUGX/Badge/Package/PackageService.php +++ b/src/PUGX/Badge/Package/PackageService.php @@ -23,7 +23,6 @@ */ class PackageService { - private static $modifierRegex = '[._-]?(?:(stable|beta|b|RC|alpha|a|patch|pl|p)(?:[.-]?(\d+))?)?([.-]?dev)?'; private static $packageClass; private $client; private $normalizer; @@ -35,33 +34,6 @@ public function __construct(Client $packagistClient, $packageClass = '\PUGX\Badg $this->normalizer = $textNormalizer; } - /** - * Factory of Packages. - * - * @return PackageInterface - */ - public static function instantiatePackage() - { - $package = self::$packageClass; - - return new $package(); - } - - /** - * Create a new Package decorated with the Api Package. - * - * @param ApiPackage $apiPackage - * - * @return PackageInterface - */ - public function instantiateAndDecoratePackage(ApiPackage $apiPackage) - { - $package = self::instantiatePackage(); - $package->setOriginalObject($apiPackage); - - return $package; - } - /** * Returns package if founded. * @@ -73,116 +45,15 @@ public function instantiateAndDecoratePackage(ApiPackage $apiPackage) */ public function fetchPackage($repository) { - $package = $this->client->get($repository); - if ($package && $package instanceof ApiPackage) { + $apiPackage = $this->client->get($repository); + if ($apiPackage && $apiPackage instanceof ApiPackage) { // create a new Package from the ApiPackage - return $this->instantiateAndDecoratePackage($package); + return Package::createFromApi($apiPackage); } throw new UnexpectedValueException(sprintf('Impossible to found repository "%s"', $repository)); } - /** - * Set the latest Stable and the latest Unstable version from a Package. - * - * @param Package $package - * - * @return Package - */ - public function calculateLatestVersions(Package &$package) - { - $versions = $package->getVersions(); - - foreach ($versions as $name => $version) { - - $currentVersionName = $version->getVersion(); - $versionNormalized = $version->getVersionNormalized(); - - $aliases = $this->getBranchAliases($version); - if (null !== $aliases && array_key_exists($currentVersionName, $aliases)) { - $currentVersionName = $aliases[$currentVersionName]; - } - - $functionName = 'Unstable'; - if ('stable' == $this->parseStability($currentVersionName)) { - $functionName = 'Stable'; - } - - if (version_compare($versionNormalized, $package->{'getLatest' . $functionName . 'VersionNormalized'}()) > 0) { - $package->{'setLatest' . $functionName . 'Version'}($currentVersionName); - $package->{'setLatest' . $functionName . 'VersionNormalized'}($versionNormalized); - - $license = $version->getLicense(); - if (is_array($license) && count($license)>0) { - $license = implode(',',$license); - } - $package->setLicense($license); - } - } - - return $package; - } - - /** - * Get all the branch aliases. - * - * @param ApiPackage\Version $version - * - * @return null|array - */ - public function getBranchAliases(ApiPackage\Version $version) - { - $extra = $version->getExtra(); - if (null !== $extra - && null !== $extra["branch-alias"] - && is_array($extra["branch-alias"]) - ) { - return $extra["branch-alias"]; - } - - return null; - } - - /** - * Returns the stability of a version. - * - * This function is part of Composer. - * - * (c) Nils Adermann - * Jordi Boggiano - * - * @param string $version - * - * @return string - */ - public function parseStability($version) - { - $version = preg_replace('{#.+$}i', '', $version); - - if ('dev-' === substr($version, 0, 4) || '-dev' === substr($version, -4)) { - return 'dev'; - } - - preg_match('{' . self::$modifierRegex . '$}i', strtolower($version), $match); - if (!empty($match[3])) { - return 'dev'; - } - - if (!empty($match[1])) { - if ('beta' === $match[1] || 'b' === $match[1]) { - return 'beta'; - } - if ('alpha' === $match[1] || 'a' === $match[1]) { - return 'alpha'; - } - if ('rc' === $match[1]) { - return 'RC'; - } - } - - return 'stable'; - } - /** * Take the Type of the Downloads (total, monthly or daily). * diff --git a/src/PUGX/Badge/Package/Tests/LatestVersionOnPackageManagerTest.php b/src/PUGX/Badge/Package/Tests/LatestVersionOnPackageManagerTest.php index 019089b1..1ab4ae7b 100644 --- a/src/PUGX/Badge/Package/Tests/LatestVersionOnPackageManagerTest.php +++ b/src/PUGX/Badge/Package/Tests/LatestVersionOnPackageManagerTest.php @@ -19,7 +19,7 @@ class LatestVersionOnPackageManagerTest extends WebTestCase { private function createPM($data, $status = 200) - { + { $packagistResponse = new \Guzzle\Http\Message\Response($status); $packagistResponse->setBody($data); $plugin = new \Guzzle\Plugin\Mock\MockPlugin(); @@ -56,9 +56,7 @@ public function testPackageShouldContainStableAndUnstableVersion($stableAssertio $pm = $this->createPM($data, 200); $package = $pm->fetchPackage('a/a'); - $package = $pm->calculateLatestVersions($package); - - $this->assertInstanceOf('PUGX\Badge\Package\PackageInterface', $package); + $this->assertInstanceOf('PUGX\Badge\Package\Package', $package); $this->assertEquals($package->getLatestStableVersion(), $stableAssertion); $this->assertEquals($package->getLatestUnstableVersion(), $unstableAssertion); } diff --git a/src/PUGX/Badge/Package/Tests/PackageManagerTest.php b/src/PUGX/Badge/Package/Tests/PackageManagerTest.php index e634556a..0bea32ac 100644 --- a/src/PUGX/Badge/Package/Tests/PackageManagerTest.php +++ b/src/PUGX/Badge/Package/Tests/PackageManagerTest.php @@ -36,9 +36,8 @@ public function testPackageShouldContainStableAndUnstableVersion($stableAssertio $pm = new PackageService($packagistClient, '\PUGX\Badge\Package\Package', $normalizer); $package = $pm->fetchPackage('puum'); - $pm->calculateLatestVersions($package); - $this->assertInstanceOf('PUGX\Badge\Package\PackageInterface', $package); + $this->assertInstanceOf('PUGX\Badge\Package\Package', $package); $this->assertEquals($package->getLatestStableVersion(), $stableAssertion); $this->assertEquals($package->getLatestUnstableVersion(), $unstableAssertion); } @@ -78,44 +77,6 @@ public function getStableAndUnstableVersion() ); } - /** - * @dataProvider getVersionAndStability - */ - public function testParseStability($version, $stable) - { - $packagistClient = \Phake::mock('Packagist\Api\Client'); - - $normalizer = $this->getMock('\PUGX\Badge\Package\TextNormalizer'); - $normalizer->expects($this->any()) - ->method('normalize') - ->willReturnCallback(function ($in) {return $in;}); - - $pm = new PackageService($packagistClient, '\PUGX\BadgeBundle\Package\Package', $normalizer); - - $this->assertEquals($pm->parseStability($version), $stable); - } - - public static function getVersionAndStability() - { - return array( - array('1.0.0', 'stable'), - array('1.1.0', 'stable'), - array('2.0.0', 'stable'), - array('3.0.x-dev', 'dev'), - array('v3.0.0-RC1', 'RC'), - array('2.3.x-dev', 'dev'), - array('2.2.x-dev', 'dev'), - array('dev-master', 'dev'), - array('2.1.x-dev', 'dev'), - array('2.0.x-dev', 'dev'), - array('v2.3.0-rc2', 'RC'), - array('v2.3.0-RC1', 'RC'), - array('v2.3.0-BETA2', 'beta'), - array('v2.1.10', 'stable'), - array('v2.2.1', 'stable'), - ); - } - protected function createVersion(array $branches) { $versions = array(); diff --git a/src/PUGX/Badge/Package/Tests/ParseStabilityTest.php b/src/PUGX/Badge/Package/Tests/ParseStabilityTest.php new file mode 100644 index 00000000..5d59f137 --- /dev/null +++ b/src/PUGX/Badge/Package/Tests/ParseStabilityTest.php @@ -0,0 +1,50 @@ +assertEquals(Package::parseStability($version), $stable); + } + + public static function getVersionAndStability() + { + return array( + array('1.0.0', 'stable'), + array('1.1.0', 'stable'), + array('2.0.0', 'stable'), + array('3.0.x-dev', 'dev'), + array('v3.0.0-RC1', 'RC'), + array('2.3.x-dev', 'dev'), + array('2.2.x-dev', 'dev'), + array('dev-master', 'dev'), + array('2.1.x-dev', 'dev'), + array('2.0.x-dev', 'dev'), + array('v2.3.0-rc2', 'RC'), + array('v2.3.0-RC1', 'RC'), + array('v2.3.0-BETA2', 'beta'), + array('v2.1.10', 'stable'), + array('v2.2.1', 'stable'), + ); + } + + protected function createVersion(array $branches) + { + $versions = array(); + foreach ($branches as $branch) { + $version = new Version(); + $version->fromArray($branch); + $versions[] = $version; + } + + return $versions; + } +} diff --git a/src/PUGX/BadgeBundle/Controller/BadgeController.php b/src/PUGX/BadgeBundle/Controller/BadgeController.php index 1ce55a1e..55013243 100644 --- a/src/PUGX/BadgeBundle/Controller/BadgeController.php +++ b/src/PUGX/BadgeBundle/Controller/BadgeController.php @@ -150,7 +150,6 @@ public function versionAction($repository, $latest = 'stable') try { $package = $this->container->get('package_service')->fetchPackage($repository); - $package = $this->container->get('package_service')->calculateLatestVersions($package); if ('stable' == $latest && $package->hasStableVersion()) { $image = $this->getImageCreator()->createStableImage($package->getLatestStableVersion()); @@ -201,7 +200,6 @@ public function licenseAction($repository) try { $package = $this->container->get('package_service')->fetchPackage($repository); - $package = $this->container->get('package_service')->calculateLatestVersions($package); $license = $package->getLicense(); if (empty($license)) { diff --git a/src/PUGX/BadgeBundle/Controller/PageController.php b/src/PUGX/BadgeBundle/Controller/PageController.php index 7f10d368..94f394d3 100644 --- a/src/PUGX/BadgeBundle/Controller/PageController.php +++ b/src/PUGX/BadgeBundle/Controller/PageController.php @@ -45,10 +45,13 @@ class PageController extends ContainerAware public function homeAction($repository) { $redisReader = $this->container->get('stats_reader'); + $poser = $this->container->get('poser'); + $prefix = sprintf('More than %s', $redisReader->totalAccess()); + $text = 'badges served !!'; return array( 'repository' => $repository, - 'total_access' => $redisReader->totalAccess() + 'badges_served_svg' => $poser->generate($prefix, $text, 'CC0066', 'svg') ); } diff --git a/src/PUGX/BadgeBundle/Resources/config/image_creator.xml b/src/PUGX/BadgeBundle/Resources/config/image_creator.xml index 7c01da77..d8cf47ce 100644 --- a/src/PUGX/BadgeBundle/Resources/config/image_creator.xml +++ b/src/PUGX/BadgeBundle/Resources/config/image_creator.xml @@ -5,28 +5,22 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - PUGX\Badge\Image\Factory\SvgImageFactory + PUGX\Badge\Image\Factory\PoserImageFactory PUGXBadgeBundle:Svg:defaultShield.svg.twig - PUGX\Badge\Image\Generator\SvgShieldGenerator - PUGX\BadgeBundle\Service\TwigAdapter + PUGX\Poser\Render\SvgRender + PUGX\Poser\Poser - - + - - - %image_creator_local.template% + + - + - - - - diff --git a/src/PUGX/BadgeBundle/Resources/config/services.xml b/src/PUGX/BadgeBundle/Resources/config/services.xml index 252c98d5..b09e43fb 100644 --- a/src/PUGX/BadgeBundle/Resources/config/services.xml +++ b/src/PUGX/BadgeBundle/Resources/config/services.xml @@ -38,6 +38,5 @@ - diff --git a/src/PUGX/BadgeBundle/Resources/views/Page/home.html.twig b/src/PUGX/BadgeBundle/Resources/views/Page/home.html.twig index 79f1d068..fb7d972a 100644 --- a/src/PUGX/BadgeBundle/Resources/views/Page/home.html.twig +++ b/src/PUGX/BadgeBundle/Resources/views/Page/home.html.twig @@ -26,7 +26,7 @@

- More than {{ total_access }} badges served


+ {{ badges_served_svg|raw }}

Badge Poser

diff --git a/src/PUGX/BadgeBundle/Resources/views/Svg/defaultShield.svg.twig b/src/PUGX/BadgeBundle/Resources/views/Svg/defaultShield.svg.twig deleted file mode 100644 index fc36097e..00000000 --- a/src/PUGX/BadgeBundle/Resources/views/Svg/defaultShield.svg.twig +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - {{ vendor }} - {{ vendor }} - {{ value }} - {{ value }} - - diff --git a/src/PUGX/BadgeBundle/Service/TwigAdapter.php b/src/PUGX/BadgeBundle/Service/TwigAdapter.php deleted file mode 100644 index e0c53c36..00000000 --- a/src/PUGX/BadgeBundle/Service/TwigAdapter.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace PUGX\BadgeBundle\Service; - -use PUGX\Badge\Image\Template\TemplateEngineInterface; - -/** - * Class TwigAdapter - * - * @author Claudio D'Alicandro - */ -class TwigAdapter implements TemplateEngineInterface -{ - /** - * @var \Twig_Environment $twig - */ - private $twig; - - public function __construct(\Twig_Environment $twig) - { - $this->twig = $twig; - } - - /** - * @param string $templatePath - * @param array $parameters - * - * @return string - */ - public function render($templatePath, array $parameters) - { - return $this->twig->render($templatePath, $parameters); - } -} diff --git a/src/PUGX/BadgeBundle/Tests/Controller/FakeImageCreator.php b/src/PUGX/BadgeBundle/Tests/Controller/FakeImageCreator.php index 28d90b22..c7502d16 100644 --- a/src/PUGX/BadgeBundle/Tests/Controller/FakeImageCreator.php +++ b/src/PUGX/BadgeBundle/Tests/Controller/FakeImageCreator.php @@ -12,11 +12,11 @@ namespace PUGX\BadgeBundle\Tests\Controller; use PUGX\BadgeBundle\Service\ImageCreator; -use Imagine\Image\ImageInterface; +use Imagine\Image\Image; class FakeImageCreator extends ImageCreator { - public function streamRawImageData(ImageInterface $image) + public function streamRawImageData(Image $image) { // pass return true;