diff --git a/.travis.yml b/.travis.yml index 7c7e14f..386cbfb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,4 +11,4 @@ before_script: - composer install script: - - ./vendor/bin/phpunit --coverage-text \ No newline at end of file + - ./bin/phpunit --coverage-text diff --git a/bin/calc b/bin/calc new file mode 100755 index 0000000..941f567 --- /dev/null +++ b/bin/calc @@ -0,0 +1,11 @@ +#!/usr/bin/env php +add(new AddComand()); +$application->run(); diff --git a/composer.json b/composer.json index 0ed4969..27c55c0 100644 --- a/composer.json +++ b/composer.json @@ -9,6 +9,10 @@ "email": "admin@seaphp.com" } ], + "bin": ["bin/calc"], + "config": { + "bin-dir": "bin" + }, "autoload": { "psr-4": { "SeaPhp\\SimpleProject\\": "src/" @@ -21,5 +25,8 @@ }, "require-dev": { "phpunit/phpunit": "~4.0" + }, + "require": { + "symfony/console": "~2.5" } -} \ No newline at end of file +} diff --git a/composer.lock b/composer.lock index 0c357c7..c3333e3 100644 --- a/composer.lock +++ b/composer.lock @@ -4,23 +4,77 @@ "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "f044a389b4e9773ec1f13623d7803f27", + "hash": "b39207e852626f6c7205d630051274cc", "packages": [ - + { + "name": "symfony/console", + "version": "v2.5.3", + "target-dir": "Symfony/Component/Console", + "source": { + "type": "git", + "url": "https://github.com/symfony/Console.git", + "reference": "cd2d1e4bac2206b337326b0140ff475fe9ad5f63" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/Console/zipball/cd2d1e4bac2206b337326b0140ff475fe9ad5f63", + "reference": "cd2d1e4bac2206b337326b0140ff475fe9ad5f63", + "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.5-dev" + } + }, + "autoload": { + "psr-0": { + "Symfony\\Component\\Console\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Symfony Console Component", + "homepage": "http://symfony.com", + "time": "2014-08-05 09:00:40" + } ], "packages-dev": [ { "name": "ocramius/instantiator", - "version": "1.1.1", + "version": "1.1.2", "source": { "type": "git", "url": "https://github.com/Ocramius/Instantiator.git", - "reference": "8aa99efa86c51319afc26d23254fe6a8b5a5144a" + "reference": "a7abbb5fc9df6e7126af741dd6c140d1a7369435" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Ocramius/Instantiator/zipball/8aa99efa86c51319afc26d23254fe6a8b5a5144a", - "reference": "8aa99efa86c51319afc26d23254fe6a8b5a5144a", + "url": "https://api.github.com/repos/Ocramius/Instantiator/zipball/a7abbb5fc9df6e7126af741dd6c140d1a7369435", + "reference": "a7abbb5fc9df6e7126af741dd6c140d1a7369435", "shasum": "" }, "require": { @@ -62,27 +116,27 @@ "constructor", "instantiate" ], - "time": "2014-08-11 23:48:35" + "time": "2014-08-14 15:10:55" }, { "name": "ocramius/lazy-map", - "version": "dev-master", + "version": "1.0.0", "source": { "type": "git", "url": "https://github.com/Ocramius/LazyMap.git", - "reference": "5c77102e225d225ae2d74d5f2cc488527834b821" + "reference": "7fe3d347f5e618bcea7d39345ff83f3651d8b752" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Ocramius/LazyMap/zipball/5c77102e225d225ae2d74d5f2cc488527834b821", - "reference": "5c77102e225d225ae2d74d5f2cc488527834b821", + "url": "https://api.github.com/repos/Ocramius/LazyMap/zipball/7fe3d347f5e618bcea7d39345ff83f3651d8b752", + "reference": "7fe3d347f5e618bcea7d39345ff83f3651d8b752", "shasum": "" }, "require": { "php": ">=5.3.3" }, "require-dev": { - "athletic/athletic": "~0.1.7", + "athletic/athletic": "~0.1.6", "phpmd/phpmd": "1.5.*", "phpunit/phpunit": ">=3.7", "satooshi/php-coveralls": "~0.6", @@ -120,20 +174,20 @@ "map", "service location" ], - "time": "2014-05-01 22:15:23" + "time": "2013-11-09 22:30:54" }, { "name": "phpunit/php-code-coverage", - "version": "dev-master", + "version": "2.0.10", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "3e7a54da59d8d0a5e146933d36620bed07913c3c" + "reference": "6d196af48e8c100a3ae881940123e693da5a9217" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/3e7a54da59d8d0a5e146933d36620bed07913c3c", - "reference": "3e7a54da59d8d0a5e146933d36620bed07913c3c", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/6d196af48e8c100a3ae881940123e693da5a9217", + "reference": "6d196af48e8c100a3ae881940123e693da5a9217", "shasum": "" }, "require": { @@ -146,7 +200,7 @@ }, "require-dev": { "ext-xdebug": ">=2.1.4", - "phpunit/phpunit": "dev-master" + "phpunit/phpunit": "~4.0.14" }, "suggest": { "ext-dom": "*", @@ -156,7 +210,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -185,7 +239,7 @@ "testing", "xunit" ], - "time": "2014-08-06 09:48:02" + "time": "2014-08-06 06:39:42" }, { "name": "phpunit/php-file-iterator", @@ -322,16 +376,16 @@ }, { "name": "phpunit/php-token-stream", - "version": "dev-master", + "version": "1.2.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "a0802561692c3b2bb0ed972f7ffafbfab068e580" + "reference": "ad4e1e23ae01b483c16f600ff1bebec184588e32" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/a0802561692c3b2bb0ed972f7ffafbfab068e580", - "reference": "a0802561692c3b2bb0ed972f7ffafbfab068e580", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/ad4e1e23ae01b483c16f600ff1bebec184588e32", + "reference": "ad4e1e23ae01b483c16f600ff1bebec184588e32", "shasum": "" }, "require": { @@ -368,20 +422,20 @@ "keywords": [ "tokenizer" ], - "time": "2014-06-26 07:15:38" + "time": "2014-03-03 05:10:30" }, { "name": "phpunit/phpunit", - "version": "dev-master", + "version": "4.2.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "24160a417c6e6a4a99708434bc53d1596be25ea0" + "reference": "58db726aa45fe26bca93f692cb3d77e9a46b7830" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/24160a417c6e6a4a99708434bc53d1596be25ea0", - "reference": "24160a417c6e6a4a99708434bc53d1596be25ea0", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/58db726aa45fe26bca93f692cb3d77e9a46b7830", + "reference": "58db726aa45fe26bca93f692cb3d77e9a46b7830", "shasum": "" }, "require": { @@ -391,11 +445,11 @@ "ext-reflection": "*", "ext-spl": "*", "php": ">=5.3.3", - "phpunit/php-code-coverage": "3.0.*@dev", + "phpunit/php-code-coverage": "~2.0", "phpunit/php-file-iterator": "~1.3.1", "phpunit/php-text-template": "~1.2", "phpunit/php-timer": "~1.0.2", - "phpunit/phpunit-mock-objects": "2.3.*@dev", + "phpunit/phpunit-mock-objects": "~2.2", "sebastian/comparator": "~1.0", "sebastian/diff": "~1.1", "sebastian/environment": "~1.0", @@ -412,7 +466,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.4.x-dev" + "dev-master": "4.2.x-dev" } }, "autoload": { @@ -442,20 +496,20 @@ "testing", "xunit" ], - "time": "2014-08-12 06:21:34" + "time": "2014-08-08 05:13:30" }, { "name": "phpunit/phpunit-mock-objects", - "version": "dev-master", + "version": "2.2.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "bc24fb59e997fc48f7cf8c839fe2beaedc76389b" + "reference": "42e589e08bc86e3e9bdf20d385e948347788505b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/bc24fb59e997fc48f7cf8c839fe2beaedc76389b", - "reference": "bc24fb59e997fc48f7cf8c839fe2beaedc76389b", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/42e589e08bc86e3e9bdf20d385e948347788505b", + "reference": "42e589e08bc86e3e9bdf20d385e948347788505b", "shasum": "" }, "require": { @@ -464,7 +518,7 @@ "phpunit/php-text-template": "~1.2" }, "require-dev": { - "phpunit/phpunit": "4.3.*@dev" + "phpunit/phpunit": "4.2.*@dev" }, "suggest": { "ext-soap": "*" @@ -472,7 +526,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3.x-dev" + "dev-master": "2.2.x-dev" } }, "autoload": { @@ -500,20 +554,20 @@ "mock", "xunit" ], - "time": "2014-08-02 13:51:34" + "time": "2014-08-02 13:50:58" }, { "name": "sebastian/comparator", - "version": "dev-master", + "version": "1.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "e54a01c0da1b87db3c5a3c4c5277ddf331da4aef" + "reference": "f7069ee51fa9fb6c038e16a9d0e3439f5449dcf2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/e54a01c0da1b87db3c5a3c4c5277ddf331da4aef", - "reference": "e54a01c0da1b87db3c5a3c4c5277ddf331da4aef", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/f7069ee51fa9fb6c038e16a9d0e3439f5449dcf2", + "reference": "f7069ee51fa9fb6c038e16a9d0e3439f5449dcf2", "shasum": "" }, "require": { @@ -565,32 +619,29 @@ "compare", "equality" ], - "time": "2014-05-11 23:00:21" + "time": "2014-05-02 07:05:58" }, { "name": "sebastian/diff", - "version": "dev-master", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "2bbf893712032f479b11afd9f3af68abb552aff7" + "reference": "1e091702a5a38e6b4c1ba9ca816e3dd343df2e2d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/2bbf893712032f479b11afd9f3af68abb552aff7", - "reference": "2bbf893712032f479b11afd9f3af68abb552aff7", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/1e091702a5a38e6b4c1ba9ca816e3dd343df2e2d", + "reference": "1e091702a5a38e6b4c1ba9ca816e3dd343df2e2d", "shasum": "" }, "require": { "php": ">=5.3.3" }, - "require-dev": { - "phpunit/phpunit": "~4.2" - }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2-dev" + "dev-master": "1.1-dev" } }, "autoload": { @@ -604,12 +655,13 @@ ], "authors": [ { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" }, { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" } ], "description": "Diff implementation", @@ -617,27 +669,27 @@ "keywords": [ "diff" ], - "time": "2014-08-10 08:30:31" + "time": "2013-08-03 16:46:33" }, { "name": "sebastian/environment", - "version": "dev-master", + "version": "1.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "10c7467da0622f7848cc5cadc0828c3359254df4" + "reference": "79517609ec01139cd7e9fded0dd7ce08c952ef6a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/10c7467da0622f7848cc5cadc0828c3359254df4", - "reference": "10c7467da0622f7848cc5cadc0828c3359254df4", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/79517609ec01139cd7e9fded0dd7ce08c952ef6a", + "reference": "79517609ec01139cd7e9fded0dd7ce08c952ef6a", "shasum": "" }, "require": { "php": ">=5.3.3" }, "require-dev": { - "phpunit/phpunit": "~4.0" + "phpunit/phpunit": "4.0.*@dev" }, "type": "library", "extra": { @@ -668,27 +720,27 @@ "environment", "hhvm" ], - "time": "2014-05-04 17:56:05" + "time": "2014-02-18 16:17:19" }, { "name": "sebastian/exporter", - "version": "dev-master", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "eb54a69388e5b7ea48561a65588f067fdda0c886" + "reference": "1f9a98e6f5dfe0524cb8c6166f7c82f3e9ae1529" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/eb54a69388e5b7ea48561a65588f067fdda0c886", - "reference": "eb54a69388e5b7ea48561a65588f067fdda0c886", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/1f9a98e6f5dfe0524cb8c6166f7c82f3e9ae1529", + "reference": "1f9a98e6f5dfe0524cb8c6166f7c82f3e9ae1529", "shasum": "" }, "require": { "php": ">=5.3.3" }, "require-dev": { - "phpunit/phpunit": "~4.0" + "phpunit/phpunit": "4.0.*@dev" }, "type": "library", "extra": { @@ -735,7 +787,7 @@ "export", "exporter" ], - "time": "2014-05-05 08:31:02" + "time": "2014-02-16 08:26:31" }, { "name": "sebastian/version", @@ -774,17 +826,17 @@ }, { "name": "symfony/yaml", - "version": "dev-master", + "version": "v2.5.3", "target-dir": "Symfony/Component/Yaml", "source": { "type": "git", "url": "https://github.com/symfony/Yaml.git", - "reference": "d84b97a12046b2c34e8457626b9f2b72dec0c183" + "reference": "5a75366ae9ca8b4792cd0083e4ca4dff9fe96f1f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Yaml/zipball/d84b97a12046b2c34e8457626b9f2b72dec0c183", - "reference": "d84b97a12046b2c34e8457626b9f2b72dec0c183", + "url": "https://api.github.com/repos/symfony/Yaml/zipball/5a75366ae9ca8b4792cd0083e4ca4dff9fe96f1f", + "reference": "5a75366ae9ca8b4792cd0083e4ca4dff9fe96f1f", "shasum": "" }, "require": { @@ -793,7 +845,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.6-dev" + "dev-master": "2.5-dev" } }, "autoload": { @@ -817,13 +869,13 @@ ], "description": "Symfony Yaml Component", "homepage": "http://symfony.com", - "time": "2014-08-05 09:07:51" + "time": "2014-08-05 09:00:40" } ], "aliases": [ ], - "minimum-stability": "dev", + "minimum-stability": "stable", "stability-flags": [ ], diff --git a/src/Command/AddComand.php b/src/Command/AddComand.php new file mode 100644 index 0000000..78cae69 --- /dev/null +++ b/src/Command/AddComand.php @@ -0,0 +1,37 @@ +setName('add') + ->setDescription('Add numbers') + ->addArgument( + 'number', InputArgument::IS_ARRAY, 'A number to add.' + ) + ; + } + + protected function execute(InputInterface $input, OutputInterface $output) { + if ($numbers = $input->getArgument('number')) { + $calc = new Calculator(0); + foreach ($numbers as $number) { + $calc->add($number); + } + $output->writeln($calc->getResult()); + } + else { + $output->writeln('No numbers to add.'); + } + } + +}