From c97ebacd475c16e484732a5699f381f5dd781582 Mon Sep 17 00:00:00 2001 From: "R. Eric Wheeler" Date: Sat, 2 Jul 2016 17:10:55 -0700 Subject: [PATCH] YamlFileLoader --- .idea/deployment.xml | 4 + .idea/vcs.xml | 6 + composer.json | 8 +- composer.lock | 209 ++++++++++++++++++++++++- src/Sikofitt/Config/YamlFileLoader.php | 20 +++ src/Sikofitt/Resume/ResumeParser.php | 43 +++++ views/base.html.twig | 1 + web/index.php | 30 +++- yaml.yml | 3 + 9 files changed, 317 insertions(+), 7 deletions(-) create mode 100644 .idea/deployment.xml create mode 100644 .idea/vcs.xml create mode 100644 src/Sikofitt/Config/YamlFileLoader.php create mode 100644 src/Sikofitt/Resume/ResumeParser.php create mode 100644 views/base.html.twig create mode 100644 yaml.yml diff --git a/.idea/deployment.xml b/.idea/deployment.xml new file mode 100644 index 0000000..7d69a67 --- /dev/null +++ b/.idea/deployment.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/composer.json b/composer.json index a4cd228..9b77310 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,8 @@ "knplabs/knp-snappy": "^0.4.3", "h4cc/wkhtmltopdf-amd64": "0.12.x", "h4cc/wkhtmltoimage-amd64": "0.12.x", - "webmozart/json": "^1.2" + "webmozart/json": "^1.2", + "symfony/yaml": "^3.1" }, "require-dev": { "symfony/asset": "~2.8|^3.0", @@ -47,12 +48,13 @@ "symfony/translation": "~2.8|^3.0", "symfony/twig-bridge": "~2.8|^3.0", "symfony/validator": "~2.8|^3.0", - "symfony/var-dumper": "~2.8|^3.0", + "symfony/var-dumper": "^3.1", "twig/twig": "~1.8|~2.0", "doctrine/dbal": "~2.2", "swiftmailer/swiftmailer": "~5", "monolog/monolog": "^1.4.1", - "symfony/console": "^3.1" + "symfony/console": "^3.1", + "texthtml/whoops-silex": "^1.0" }, "replace": { "silex/api": "v2.0.2", diff --git a/composer.lock b/composer.lock index 8e5c3d0..449f746 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "b9e1282f8f9e035b8a9bd6022d47c4aa", - "content-hash": "6c34bb3b977c218536d5228013f3ab7e", + "hash": "25df9af0b41ac7ef6d45ab96d5d667b7", + "content-hash": "03d1d2ef3ffe14233c10db19ae9521f6", "packages": [ { "name": "h4cc/wkhtmltoimage-amd64", @@ -792,6 +792,61 @@ ], "time": "2016-07-01 08:30:59" }, + { + "name": "symfony/yaml", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "b69648974b39cc6f76aea9d3aee8212cd0c0d75d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/b69648974b39cc6f76aea9d3aee8212cd0c0d75d", + "reference": "b69648974b39cc6f76aea9d3aee8212cd0c0d75d", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "require-dev": { + "symfony/console": "~2.8|~3.0" + }, + "suggest": { + "symfony/console": "For validating YAML files using the lint command" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Yaml Component", + "homepage": "https://symfony.com", + "time": "2016-07-01 16:08:10" + }, { "name": "webmozart/assert", "version": "dev-master", @@ -1408,6 +1463,66 @@ ], "time": "2014-09-09 13:34:57" }, + { + "name": "filp/whoops", + "version": "2.1.2", + "source": { + "type": "git", + "url": "https://github.com/filp/whoops.git", + "reference": "d13505b240a6f580bc75ba591da30299d6cb0eec" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/filp/whoops/zipball/d13505b240a6f580bc75ba591da30299d6cb0eec", + "reference": "d13505b240a6f580bc75ba591da30299d6cb0eec", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "require-dev": { + "mockery/mockery": "0.9.*", + "phpunit/phpunit": "^4.8 || ^5.0", + "symfony/var-dumper": "~3.0" + }, + "suggest": { + "symfony/var-dumper": "Pretty print complex values better with var-dumper available", + "whoops/soap": "Formats errors as SOAP responses" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "psr-4": { + "Whoops\\": "src/Whoops/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Filipe Dobreira", + "homepage": "https://github.com/filp", + "role": "Developer" + } + ], + "description": "php error handling for cool kids", + "homepage": "https://github.com/filp/whoops", + "keywords": [ + "error", + "exception", + "handling", + "library", + "whoops", + "zf2" + ], + "time": "2016-04-07 06:16:25" + }, { "name": "monolog/monolog", "version": "1.x-dev", @@ -3245,6 +3360,96 @@ ], "time": "2016-06-29 05:43:32" }, + { + "name": "texthtml/whoops-pimple", + "version": "v1.2.0", + "source": { + "type": "git", + "url": "https://github.com/texthtml/whoops-pimple.git", + "reference": "bb31b1ca8f73a0e8e41ccb14e1fe599f0a0fc86b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/texthtml/whoops-pimple/zipball/bb31b1ca8f73a0e8e41ccb14e1fe599f0a0fc86b", + "reference": "bb31b1ca8f73a0e8e41ccb14e1fe599f0a0fc86b", + "shasum": "" + }, + "require": { + "filp/whoops": "^2.0", + "pimple/pimple": "^3.0", + "symfony/http-kernel": "^2.0|^3.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "WhoopsPimple\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "AGPL-3.0" + ], + "authors": [ + { + "name": "Mathieu Rochette", + "email": "mathieu@rochette.cc", + "homepage": "https://mathieu.rochette.cc" + } + ], + "description": "Integrates the Whoops library into Pimple", + "keywords": [ + "error", + "exception", + "pimple", + "silex", + "whoops" + ], + "time": "2016-02-29 12:46:39" + }, + { + "name": "texthtml/whoops-silex", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/texthtml/whoops-silex.git", + "reference": "bc4797ba761db398c9f1f532dd00d9487aa46dc3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/texthtml/whoops-silex/zipball/bc4797ba761db398c9f1f532dd00d9487aa46dc3", + "reference": "bc4797ba761db398c9f1f532dd00d9487aa46dc3", + "shasum": "" + }, + "require": { + "silex/silex": "~2.0@dev", + "texthtml/whoops-pimple": "~1.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "WhoopsSilex\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "AGPL-3.0" + ], + "authors": [ + { + "name": "Mathieu Rochette", + "email": "mathieu@rochette.cc", + "homepage": "https://mathieu.rochette.cc" + } + ], + "description": "Integrates the Whoops library into Silex", + "keywords": [ + "error", + "exception", + "silex", + "whoops" + ], + "time": "2015-04-09 08:49:20" + }, { "name": "twig/twig", "version": "dev-master", diff --git a/src/Sikofitt/Config/YamlFileLoader.php b/src/Sikofitt/Config/YamlFileLoader.php new file mode 100644 index 0000000..1dce7aa --- /dev/null +++ b/src/Sikofitt/Config/YamlFileLoader.php @@ -0,0 +1,20 @@ +get('/', function () { - return 'Hello!'; +$app->register(new TwigServiceProvider(), [ + 'twig.path' => __DIR__.'/../views', +]); +$app->register(new WhoopsServiceProvider()); + +$app['json.decoder'] = function($app) { + return new Webmozart\Json\JsonDecoder(); +}; +$app['json.encoder'] = function($app) { + return new Webmozart\Json\JsonEncoder(); +}; +$app['json.validator'] = function($app) { + return new Webmozart\Json\JsonValidator(); +}; + +$app->get('/', function() use($app) { + + $yaml = Yaml::parse(file_get_contents(APP_ROOT . 'yaml.yml')); + dump($yaml); + return $app['twig']->render('base.html.twig'); }); $app->run(); diff --git a/yaml.yml b/yaml.yml new file mode 100644 index 0000000..56d317c --- /dev/null +++ b/yaml.yml @@ -0,0 +1,3 @@ +first: + - { second: Third } + \ No newline at end of file