From 21b043cfa3ef8bee2b4268d00d3d7429d90f9f6a Mon Sep 17 00:00:00 2001 From: sikofitt Date: Fri, 8 Jul 2016 14:58:30 -0700 Subject: [PATCH] Check changelog --- .php_cs | 46 ++++ app/App.php | 134 ++++++++--- app/config/config.yml | 7 +- app/config/default/config.php | 11 +- app/providers.php | 51 ++++ app/views/resume.html.twig | 67 +++++- app/views/uikit.html.twig | 1 + bower.json | 3 +- composer.json | 6 +- composer.lock | 224 +++++++++++++++++- data/{ => schema}/bad.schema.json | 0 .../schema.v1.json} | 0 dump.php | 11 +- .../Command/SchemaValidationCommand.php | 37 +-- src/Sikofitt/Config/ConfigServiceProvider.php | 16 +- src/Sikofitt/Config/ConfigTrait.php | 22 +- .../Controller/ApiControllerProvider.php | 76 ++++++ .../Controller/ResumeControllerProvider.php | 145 ++++++++++++ .../Image/Profile/FacebookProfileIcon.php | 37 ++- .../Image/Profile/GithubProfileIcon.php | 29 ++- .../Image/Profile/GitlabProfileIcon.php | 44 ++-- .../Image/Profile/LinkedinProfileIcon.php | 37 ++- .../Image/Profile/ProfileIconInterface.php | 18 +- .../Image/Profile/TwitterProfileIcon.php | 39 +-- src/Sikofitt/Json/JsonFileTrait.php | 39 +++ src/Sikofitt/Json/JsonServiceProvider.php | 42 ++++ src/Sikofitt/Json/JsonTrait.php | 50 ++++ src/Sikofitt/Json/ResumeBuilder.php | 39 +-- src/Sikofitt/Resume/ResumeParser.php | 19 +- src/Sikofitt/Twig/Date.php | 32 ++- src/Sikofitt/Twig/RenderProfile.php | 69 +++--- src/Sikofitt/less/resume.less | 1 + web/index.php | 108 +-------- 33 files changed, 1153 insertions(+), 307 deletions(-) create mode 100644 .php_cs create mode 100644 app/providers.php rename data/{ => schema}/bad.schema.json (100%) rename data/{resume.schema.json => schema/schema.v1.json} (100%) create mode 100644 src/Sikofitt/Controller/ApiControllerProvider.php create mode 100644 src/Sikofitt/Controller/ResumeControllerProvider.php create mode 100644 src/Sikofitt/Json/JsonFileTrait.php create mode 100644 src/Sikofitt/Json/JsonServiceProvider.php create mode 100644 src/Sikofitt/Json/JsonTrait.php diff --git a/.php_cs b/.php_cs new file mode 100644 index 0000000..e691cb4 --- /dev/null +++ b/.php_cs @@ -0,0 +1,46 @@ + + +For the full copyright and license information, please view the LICENSE +file that was distributed with this source code. +EOF; + +Symfony\CS\Fixer\Contrib\HeaderCommentFixer::setHeader($header); + +$finder = Symfony\CS\Finder\DefaultFinder::create() + ->exclude('vendor') + ->exclude('tests') + ->exclude('var') + ->exclude('node_modules') + ->ignoreDotFiles(true) + ->ignoreVCS(true) + ->name('*.php') + ->in(__DIR__) + ; + + +return Symfony\CS\Config\Config::create() + ->level(Symfony\CS\FixerInterface::PSR2_LEVEL) + ->fixers( + [ + 'header_comment', + 'ordered_use', + 'php_unit_construct', + 'php_unit_strict', + 'strict', + 'strict_param', + 'symfony', + 'newline_after_open_tag', + 'phpdoc_order', + 'short_array_syntax', + 'short_echo_tag', + + + ] + ) + ->finder($finder) + ; \ No newline at end of file diff --git a/app/App.php b/app/App.php index 1b64e50..9cd296b 100644 --- a/app/App.php +++ b/app/App.php @@ -1,6 +1,17 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + use Sikofitt\Config\ConfigTrait; +use Sikofitt\Json\JsonFileTrait; +use Sikofitt\Json\JsonTrait; use Silex\Application; require '../vendor/autoload.php'; @@ -8,16 +19,17 @@ require '../vendor/autoload.php'; /** * Class App */ -class App extends Application { +class App extends Application +{ - use ConfigTrait; - use Application\TwigTrait; - use Application\MonologTrait; - use Application\SwiftmailerTrait; - use Application\TranslationTrait; - use Application\UrlGeneratorTrait; - - public $conf; + use ConfigTrait; + use JsonTrait; + use JsonFileTrait; + use Application\TwigTrait; + use Application\MonologTrait; + use Application\SwiftmailerTrait; + use Application\TranslationTrait; + use Application\UrlGeneratorTrait; /** * Returns the application directory. @@ -25,9 +37,10 @@ class App extends Application { * @return string * The main application directory. */ - public function getAppDirectory() { - $r = new ReflectionClass($this); - return dirname($r->getFileName()); + public function getAppDirectory() + { + $r = new ReflectionClass($this); + return dirname($r->getFileName()); } /** @@ -36,38 +49,48 @@ class App extends Application { * @return string * The root directory of the application. */ - public function getRootDirectory() { - return dirname($this->getAppDirectory()); + public function getRootDirectory() + { + return dirname($this->getAppDirectory()); } /** * @return string */ - public function getConfDirectory() { - return $this->getAppDirectory() . '/config'; + public function getConfDirectory() + { + return $this->getAppDirectory() . '/config'; } /** * @return string */ - public function getDataDirectory() { - return $this->getRootDirectory() . '/data'; + public function getDataDirectory() + { + return $this->getRootDirectory() . '/data'; } /** * @return string */ - public function getResumeJson() { - return $this->getDataDirectory() . '/resume.json'; + public function getResumeJson() + { + return $this->getDataDirectory() . '/resume.json'; } /** * @return string */ - public function getResumeSchema() { - return $this->getDataDirectory() . '/resume.schema.json'; + public function getResumeSchema() + { + return $this->getDataDirectory() . '/resume.schema.json'; } + public function getLogDirectory() + { + return $this->getDataDirectory() . '/logs'; + } + /** * Registers media icons * @@ -77,15 +100,64 @@ class App extends Application { { $this->config(sprintf('app.icons.%s', $icon->getName()), ['icon' => $icon->getIcon(), 'url' => $icon->getDefaultUrl()]); } + public function setDebug() + { + $this['debug'] = null !== $this->config('app.debug') ? $this->config('app.debug') : true; + $this['env'] = getenv('PHP_ENV'); + if (!$this['env']) { + $this['env'] = null !== $this->config('app.environment') ? $this->config('app.environment') : 'dev'; + } + } + public function registerExtenders() + { + if (!$this['debug']) { + $this->error(function (\Exception $e, \Symfony\Component\HttpFoundation\Request $request, $code) { + switch ($code) { + case 405: - public function boot() { - // register default icons - $this->registerIcon(new \Sikofitt\Image\Profile\TwitterProfileIcon()); - $this->registerIcon(new \Sikofitt\Image\Profile\FacebookProfileIcon()); - $this->registerIcon(new \Sikofitt\Image\Profile\GithubProfileIcon()); - $this->registerIcon(new \Sikofitt\Image\Profile\GitlabProfileIcon()); - $this->registerIcon(new \Sikofitt\Image\Profile\LinkedinProfileIcon()); - return parent::boot(); + + preg_match('/\(Allow\:(.+)\)/', $e->getMessage(), $matches); + if(isset($matches[1])) { + $matches = trim($matches[1]); + } elseif(isset($matches[0])) { + $matches = trim($matches[0]); + } else { + $matches = 'Available methods are unknown.'; + } + $message = json_encode(['status' => 'error', 'message' => 'Method not allowed', 'allowedMethods' => $matches, 'requestedMethod' => $request->getMethod(), 'code' => $code]); + //$message = 'Sorry bout that.
' . $e->getMessage(); + break; + default: + $message = $this['twig']->render('error500.html.twig'); + } + return new \Symfony\Component\HttpFoundation\Response($message, $code); + }); + } + $this->extend('twig', function (\Twig_Environment $twig) { + if ($this['debug']) { + $twig->enableDebug(); + } + $twig->addExtension(new Twig_Extensions_Extension_Date()); + $twig->addExtension(new Sikofitt\Twig\Date()); + $twig->addExtension(new Sikofitt\Twig\RenderProfile()); + $twig->addGlobal('config', $this->config('all')); + return $twig; + }); } -} + public function boot() + { + $this->registerExtenders(); + // register default icons + $this->registerDefaultIcons(); + return parent::boot(); + } + public function registerDefaultIcons() + { + $this->registerIcon(new \Sikofitt\Image\Profile\TwitterProfileIcon()); + $this->registerIcon(new \Sikofitt\Image\Profile\FacebookProfileIcon()); + $this->registerIcon(new \Sikofitt\Image\Profile\GithubProfileIcon()); + $this->registerIcon(new \Sikofitt\Image\Profile\GitlabProfileIcon()); + $this->registerIcon(new \Sikofitt\Image\Profile\LinkedinProfileIcon()); + } +} diff --git a/app/config/config.yml b/app/config/config.yml index 263a067..82ffeed 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -1,7 +1,10 @@ app: - debug: true - environment: dev + debug: false + environment: prod title: R. Eric Wheeler | Resume + email: eric@rewiv.com + phone: 510-646-2135 + schema: https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/schema.json twig: paths: - views diff --git a/app/config/default/config.php b/app/config/default/config.php index 1e0fc24..e0e9429 100644 --- a/app/config/default/config.php +++ b/app/config/default/config.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + return [ 'app' => 'neat', -]; \ No newline at end of file +]; diff --git a/app/providers.php b/app/providers.php new file mode 100644 index 0000000..e8d14f6 --- /dev/null +++ b/app/providers.php @@ -0,0 +1,51 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +$app->register(new \Sikofitt\Config\ConfigServiceProvider(), [ + 'config.path' => $app->getConfDirectory(), +]); + +$app->setDebug(); + +if (null === $app->config('app.schema')) { + $app->config('app.schema', 'https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/schema.json'); +} + +$app->register(new \Silex\Provider\TwigServiceProvider(), [ + 'twig.path' => [ + $app->getRootDirectory() . '/app/views', + ], +]); +$app->register(new \Sikofitt\Json\JsonServiceProvider()); + + +$app->register(new \Silex\Provider\AssetServiceProvider()); +$app->register(new \Silex\Provider\MonologServiceProvider()); +$app->register(new \Silex\Provider\SessionServiceProvider()); +$app->register(new \Silex\Provider\HttpKernelServiceProvider()); +$app->register(new \Silex\Provider\FormServiceProvider()); + + +$app->register(new \Silex\Provider\MonologServiceProvider(), + [ + 'monolog.logfile' => sprintf('%s/%s.log', $app->getLogDirectory(), $app['env']), + ] +); +$app->register(new \Silex\Provider\RoutingServiceProvider()); +$app->register(new \Silex\Provider\ServiceControllerServiceProvider()); +$app->register(new \Silex\Provider\HttpFragmentServiceProvider()); +if ($app['debug'] || 0 === strcasecmp($app['env'], 'dev')) { + $app->register(new \Silex\Provider\WebProfilerServiceProvider(), [ + 'profiler.cache_dir' => $app->getDataDirectory() . '/cache/profiler', + ]); + $app->register(new \WhoopsSilex\WhoopsServiceProvider()); + $app->register(new \Silex\Provider\VarDumperServiceProvider()); +} diff --git a/app/views/resume.html.twig b/app/views/resume.html.twig index f4a8671..bc14edd 100644 --- a/app/views/resume.html.twig +++ b/app/views/resume.html.twig @@ -5,7 +5,6 @@ {% endblock %} {% block body %} -

@@ -62,7 +61,7 @@
Highlights
{% for highlight in position.highlights %} -
{{ highlight|raw }}
+
{{ highlight|raw }} {# raw is deprecated in 2.0 #}
{% endfor %}
{% endif %} @@ -73,6 +72,7 @@

+
@@ -86,12 +86,10 @@
+
+
+
+ + +
+ +
+

Verify

+
+

Verify that you are a human please.

+
+
+
+
+
+ +
+
+ +
+
+
+
@@ -179,5 +201,36 @@
+
+{% endblock %} + {% block javascripts_foot %} + + {% endblock %} +{% block inline_js_foot %} + {% endblock %} \ No newline at end of file diff --git a/app/views/uikit.html.twig b/app/views/uikit.html.twig index 0d175df..964644d 100644 --- a/app/views/uikit.html.twig +++ b/app/views/uikit.html.twig @@ -18,6 +18,7 @@ + {% block javascripts_head %}{% endblock %} {% block inline_js_head %}{% endblock %} diff --git a/bower.json b/bower.json index 1177b88..63ccc61 100644 --- a/bower.json +++ b/bower.json @@ -31,7 +31,8 @@ "**/scrollspy.min.js", "**/parallax.min.js", "**/offcanvas.min.js", - "**/sticky.min.js" + "**/sticky.min.js", + "**/notify.min.js" ] }, "jquery": { diff --git a/composer.json b/composer.json index f39529b..f9f2a27 100644 --- a/composer.json +++ b/composer.json @@ -49,11 +49,13 @@ "symfony/var-dumper": "^3.1", "symfony/console": "^3.1", "texthtml/whoops-silex": "^1.0", - "symfony/debug-bundle": "^3.1" + "symfony/debug-bundle": "^3.1", + "friendsofphp/php-cs-fixer": "^1.11" }, "autoload": { "psr-4": { "Sikofitt\\": "src/Sikofitt" - } + }, + "classmap": ["app/App.php"] } } diff --git a/composer.lock b/composer.lock index 4cd9c73..e9f5494 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": "2e202af761710c5e2279e9f5b83a5192", - "content-hash": "3c41da3f56c72d6c1bc86d0a1889d6d9", + "hash": "84ec84a01cd2f9b1398d356bc5e7dc63", + "content-hash": "d91f02739d0cdaa4d0346a6c0f765fc3", "packages": [ { "name": "google/recaptcha", @@ -719,23 +719,23 @@ }, { "name": "swiftmailer/swiftmailer", - "version": "v5.4.2", + "version": "v5.4.3", "source": { "type": "git", "url": "https://github.com/swiftmailer/swiftmailer.git", - "reference": "d8db871a54619458a805229a057ea2af33c753e8" + "reference": "4cc92842069c2bbc1f28daaaf1d2576ec4dfe153" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/d8db871a54619458a805229a057ea2af33c753e8", - "reference": "d8db871a54619458a805229a057ea2af33c753e8", + "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/4cc92842069c2bbc1f28daaaf1d2576ec4dfe153", + "reference": "4cc92842069c2bbc1f28daaaf1d2576ec4dfe153", "shasum": "" }, "require": { "php": ">=5.3.3" }, "require-dev": { - "mockery/mockery": "~0.9.1,<0.9.4" + "mockery/mockery": "~0.9.1" }, "type": "library", "extra": { @@ -768,7 +768,7 @@ "mail", "mailer" ], - "time": "2016-05-01 08:45:47" + "time": "2016-07-08 11:51:25" }, { "name": "symfony/asset", @@ -2506,6 +2506,116 @@ ], "time": "2016-04-07 06:16:25" }, + { + "name": "friendsofphp/php-cs-fixer", + "version": "v1.11.5", + "source": { + "type": "git", + "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", + "reference": "d3d08b76753092a232a4d8c3b94095ac06898719" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/d3d08b76753092a232a4d8c3b94095ac06898719", + "reference": "d3d08b76753092a232a4d8c3b94095ac06898719", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=5.3.6", + "sebastian/diff": "~1.1", + "symfony/console": "~2.3|~3.0", + "symfony/event-dispatcher": "~2.1|~3.0", + "symfony/filesystem": "~2.1|~3.0", + "symfony/finder": "~2.1|~3.0", + "symfony/process": "~2.3|~3.0", + "symfony/stopwatch": "~2.5|~3.0" + }, + "conflict": { + "hhvm": "<3.9" + }, + "require-dev": { + "phpunit/phpunit": "^4.5|^5", + "satooshi/php-coveralls": "^0.7.1" + }, + "bin": [ + "php-cs-fixer" + ], + "type": "application", + "autoload": { + "psr-4": { + "Symfony\\CS\\": "Symfony/CS/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Dariusz RumiƄski", + "email": "dariusz.ruminski@gmail.com" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "A tool to automatically fix PHP code style", + "time": "2016-07-06 22:49:35" + }, + { + "name": "sebastian/diff", + "version": "1.4.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e", + "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff" + ], + "time": "2015-12-08 07:14:41" + }, { "name": "symfony/console", "version": "v3.1.2", @@ -2627,6 +2737,104 @@ "homepage": "https://symfony.com", "time": "2016-02-13 09:24:02" }, + { + "name": "symfony/filesystem", + "version": "v3.1.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/filesystem.git", + "reference": "322da5f0910d8aa0b25fa65ffccaba68dbddb890" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/322da5f0910d8aa0b25fa65ffccaba68dbddb890", + "reference": "322da5f0910d8aa0b25fa65ffccaba68dbddb890", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Filesystem\\": "" + }, + "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 Filesystem Component", + "homepage": "https://symfony.com", + "time": "2016-06-29 05:41:56" + }, + { + "name": "symfony/finder", + "version": "v3.1.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "8201978de88a9fa0923e18601bb17f1df9c721e7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/8201978de88a9fa0923e18601bb17f1df9c721e7", + "reference": "8201978de88a9fa0923e18601bb17f1df9c721e7", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Finder\\": "" + }, + "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 Finder Component", + "homepage": "https://symfony.com", + "time": "2016-06-29 05:41:56" + }, { "name": "symfony/phpunit-bridge", "version": "v3.1.2", diff --git a/data/bad.schema.json b/data/schema/bad.schema.json similarity index 100% rename from data/bad.schema.json rename to data/schema/bad.schema.json diff --git a/data/resume.schema.json b/data/schema/schema.v1.json similarity index 100% rename from data/resume.schema.json rename to data/schema/schema.v1.json diff --git a/dump.php b/dump.php index 81c0245..9366a91 100644 --- a/dump.php +++ b/dump.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + require_once 'vendor/autoload.php'; @@ -8,5 +17,3 @@ $decoder = new Webmozart\Json\JsonDecoder(); $json = $decoder->decodeFile('data/resume.json'); dump($json); - - diff --git a/src/Sikofitt/Command/SchemaValidationCommand.php b/src/Sikofitt/Command/SchemaValidationCommand.php index 0fe4317..4b121be 100644 --- a/src/Sikofitt/Command/SchemaValidationCommand.php +++ b/src/Sikofitt/Command/SchemaValidationCommand.php @@ -1,4 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + /** * Created by PhpStorm. * User: eric @@ -8,7 +18,6 @@ namespace Sikofitt\Command; - use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -29,11 +38,11 @@ class SchemaValidationCommand extends Command * Configures the command. * */ - public function configure () + public function configure() { - $this->setName ('resume:schema:validate') - ->setDescription ('Validates resume.json schema') - ->setProcessTitle ('Validating Schema'); + $this->setName('resume:schema:validate') + ->setDescription('Validates resume.json schema') + ->setProcessTitle('Validating Schema'); } /** @@ -42,13 +51,11 @@ class SchemaValidationCommand extends Command * @param InputInterface $input * @param OutputInterface $output */ - public function interact (InputInterface $input, OutputInterface $output) + public function interact(InputInterface $input, OutputInterface $output) { - $io = new SymfonyStyle($input, $output); $this->file = $io->ask('Path to file? '); $this->schema = $io->ask('Path to schema? '); - } /** @@ -59,7 +66,7 @@ class SchemaValidationCommand extends Command * * @return void */ - public function execute (InputInterface $input, OutputInterface $output) + public function execute(InputInterface $input, OutputInterface $output) { $validator = new JsonValidator(); $decoder = new JsonDecoder(); @@ -68,20 +75,16 @@ class SchemaValidationCommand extends Command try { $decoded = $decoder->decodeFile($dataDir . $this->file); - $errors = $validator->validate ($decoded, $dataDir . $this->schema); - } catch(\Exception $e) { + $errors = $validator->validate($decoded, $dataDir . $this->schema); + } catch (\Exception $e) { $class = new \ReflectionClass($e); $io->block([$class->getName(), $e->getMessage()], 'Exception', 'error'); exit(255); } - if(isset($errors) && !empty($errors)) { + if (isset($errors) && !empty($errors)) { $io->block($errors, 'Error', 'error'); } else { $io->block([$this->file, 'There were no errors reported.'], 'Valid Schema', 'fg=black;bg=green'); - - } } - - -} \ No newline at end of file +} diff --git a/src/Sikofitt/Config/ConfigServiceProvider.php b/src/Sikofitt/Config/ConfigServiceProvider.php index 24a1f06..e31865f 100644 --- a/src/Sikofitt/Config/ConfigServiceProvider.php +++ b/src/Sikofitt/Config/ConfigServiceProvider.php @@ -1,14 +1,20 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. */ namespace Sikofitt\Config; +use Noodlehaus\Config; use Pimple\Container; use Pimple\ServiceProviderInterface; use Silex\Application; -use Noodlehaus\Config; /** * Class ConfigServiceProvider @@ -19,11 +25,11 @@ class ConfigServiceProvider implements ServiceProviderInterface /** * @param Container $app */ - public function register (Container $app) + public function register(Container $app) { - $app['config'] = function($app) { + $app['config'] = function ($app) { $config = Config::load($app['config.path']); return $config; }; } -} \ No newline at end of file +} diff --git a/src/Sikofitt/Config/ConfigTrait.php b/src/Sikofitt/Config/ConfigTrait.php index 4675d19..ed7efca 100644 --- a/src/Sikofitt/Config/ConfigTrait.php +++ b/src/Sikofitt/Config/ConfigTrait.php @@ -1,4 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + /** * */ @@ -12,15 +22,15 @@ trait ConfigTrait * @param null $value * @return mixed */ - public function config($name, $value = null) { - if(strcasecmp($name, 'all') === 0) { + public function config($name, $value = null) + { + if (strcasecmp($name, 'all') === 0) { return $this['config']->all(); } - if(null === $value) { - return $this['config']->get ($name); + if (null === $value) { + return $this['config']->get($name); } else { $this['config']->set($name, $value); } } - -} \ No newline at end of file +} diff --git a/src/Sikofitt/Controller/ApiControllerProvider.php b/src/Sikofitt/Controller/ApiControllerProvider.php new file mode 100644 index 0000000..55e2efa --- /dev/null +++ b/src/Sikofitt/Controller/ApiControllerProvider.php @@ -0,0 +1,76 @@ + + * + * 7/8/16 / 10:11 AM + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Sikofitt\Controller; + +use ReCaptcha\ReCaptcha; +use Silex\Application; +use Silex\Api\ControllerProviderInterface; +use Symfony\Component\HttpFoundation\JsonResponse; +use Symfony\Component\HttpFoundation\Request; + +class ApiControllerProvider implements ControllerProviderInterface { + + public function connect(Application $app) { + $controllers = $app['controllers_factory']; + + $controllers->get('/v1/schema', function() { + return new \Symfony\Component\HttpFoundation\Response('Success!'); + }); + + $controllers->post('/v1/captcha', function(Request $request) use ($app) { + $captcha = new ReCaptcha('6LcvmSQTAAAAAITkvYJjgLar1LqGGLz-ic0ZMiXo'); + + $valid = $captcha->verify( + $request->request->get('g-recaptcha-response'), + $request->server->get('REMOTE_ADDR') + ); + if($valid->isSuccess()) { + $return = [ + 'valid' => true, + 'message' => [ + 'email' => null !== $app->config('app.email') ? $app->config('app.email') : 'No email has been set in the configuration. Please let the owner know.', + 'phone' => null !== $app->config('app.phone') ? $app->config('app.phone') : 'No phone has been set in the configuration. Please let the owner know.', + ], + ]; + } else { + + $errorCodes = [ + 'missing-input-secret' => 'The secret parameter is missing.', + 'invalid-input-secret' => 'The secret parameter is invalid or malformed.', + 'missing-input-response' =>'The response parameter is missing.', + 'invalid-input-response' => 'The response parameter is invalid or malformed.' + ]; + + foreach($valid->getErrorCodes() as $code) + { + if(array_key_exists($code, $errorCodes)) { + $errors[] = $errorCodes[$code]; + } + } + if(!isset($errors)) { + $errors[] = 'An unknown error occurred.'; + } + $return = [ + 'valid' => false, + 'message' => $errors, + ]; + } + + return new JsonResponse(json_encode($return)); + }); + + return $controllers; + } +} \ No newline at end of file diff --git a/src/Sikofitt/Controller/ResumeControllerProvider.php b/src/Sikofitt/Controller/ResumeControllerProvider.php new file mode 100644 index 0000000..229c710 --- /dev/null +++ b/src/Sikofitt/Controller/ResumeControllerProvider.php @@ -0,0 +1,145 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Sikofitt\Controller; + +use ReCaptcha\ReCaptcha; +use Silex\Api\ControllerProviderInterface; +use Silex\Application; +use Symfony\Component\HttpFoundation\Request; + +/** + * Class ResumeControllerProvider + * @package Sikofitt\Controller + */ +class ResumeControllerProvider implements ControllerProviderInterface +{ + + /** + * @var object + */ + private $resumeData; + + /** + * @param Application $app + * @return mixed + */ + public function connect(Application $app) + { + $this->resumeData = $app->decodeFile( + $app->getDataDirectory() . '/resume.json', + $app->getDataDirectory() . '/schema/schema.v1.json' + ); + + + $controllers = $app['controllers_factory']; + + $controllers->get('/', function (Request $request) use ($app) { + + return $app['twig']->render('resume.html.twig', [ + + 'fullData' => $this->resumeData, + 'basics' => $this->getResumeBasics(), + 'work' => $this->getResumeWork(), + 'volunteer' => $this->getResumeVolunteer(), + 'education' => $this->getResumeEducation(), + 'awards' => $this->getResumeAwards(), + 'publications' => $this->getResumePublications(), + 'skills' => $this->getResumeSkills(), + 'languages' => $this->getResumeLanguages(), + 'interests' => $this->getResumeInterests(), + 'references' => $this->getResumeReferences(), + ]); + }); + + return $controllers; + } + + /** + * @return null + */ + public function getResumeBasics() + { + return (isset($this->resumeData->basics) && count($this->resumeData->basics) > 0) ? $this->resumeData->basics : null; + } + + /** + * @return null + */ + public function getResumeWork() + { + return (isset($this->resumeData->work) && count($this->resumeData->work) > 0) ? $this->resumeData->work : null; + } + + /** + * @return null + */ + public function getResumeVolunteer() + { + return (isset($this->resumeData->volunteer) && count($this->resumeData->volunteer) > 0) ? $this->resumeData->volunteer : null; + } + + /** + * @return null + */ + public function getResumeEducation() + { + return (isset($this->resumeData->education) && count($this->resumeData->education) > 0) ? $this->resumeData->education : null; + } + + /** + * @return null + */ + public function getResumeAwards() + { + return (isset($this->resumeData->awards) && count($this->resumeData->awards) > 0) ? $this->resumeData->awards : null; + } + + /** + * @return null + */ + public function getResumePublications() + { + return (isset($this->resumeData->publications) && count($this->resumeData->publications) > 0) ? $this->resumeData->publications : null; + } + + /** + * @return null + */ + public function getResumeSkills() + { + return (isset($this->resumeData->skills) && count($this->resumeData->skills) > 0) ? $this->resumeData->skills : null; + } + + /** + * @return null + */ + public function getResumeLanguages() + { + return (isset($this->resumeData->languages) && count($this->resumeData->languages) > 0) ? $this->resumeData->languages : null; + } + + /** + * @return null + */ + public function getResumeInterests() + { + return (isset($this->resumeData->interests) && count($this->resumeData->interests) > 0) ? $this->resumeData->interests : null; + } + + /** + * @return null + */ + public function getResumeReferences() + { + return (isset($this->resumeData->references) && count($this->resumeData->references) > 0) ? $this->resumeData->references : null; + } +} diff --git a/src/Sikofitt/Image/Profile/FacebookProfileIcon.php b/src/Sikofitt/Image/Profile/FacebookProfileIcon.php index a0b0231..aff9616 100644 --- a/src/Sikofitt/Image/Profile/FacebookProfileIcon.php +++ b/src/Sikofitt/Image/Profile/FacebookProfileIcon.php @@ -1,4 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + /** * This file is part of resume. * @@ -14,18 +24,21 @@ namespace Sikofitt\Image\Profile; +class FacebookProfileIcon implements ProfileIconInterface +{ -class FacebookProfileIcon implements ProfileIconInterface { + public function getName() + { + return 'facebook'; + } - public function getName() { - return 'facebook'; - } + public function getDefaultUrl() + { + return 'https://facebook.com'; + } - public function getDefaultUrl() { - return 'https://facebook.com'; - } - - public function getIcon() { - return 'data:image/x-icon;base64,AAABAAIAICAAAAEAIACoEAAAJgAAABAQAAABACAAaAQAAM4QAAAoAAAAIAAAAEAAAAABACAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAlFZBSp5eROejYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+bXUT//////////////////////5tdRP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+eX0TklFZBSgAAAAAAAAAAAAAAAAAAAACZWkLmo2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/5tdRP//////////////////////m11E/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+aW0PnAAAAAAAAAAAAAAAAAAAAAJtdRP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/m11E//////////////////////+bXUT/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/5tdRP8AAAAAAAAAAAAAAAAAAAAAm11E/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+bXUT//////////////////////5tdRP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/m11E/wAAAAAAAAAAAAAAAAAAAACbXUT/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/5tdRP//////////////////////m11E/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+bXUT/AAAAAAAAAAAAAAAAAAAAAJtdRP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/m11E//////////////////////+bXUT/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/5tdRP8AAAAAAAAAAAAAAAAAAAAAm11E/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+bXUT//////////////////////5tdRP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/m11E/wAAAAAAAAAAAAAAAAAAAACbXUT/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/5tdRP//////////////////////m11E/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+bXUT/AAAAAAAAAAAAAAAAAAAAAJtdRP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/m11E//////////////////////+bXUT/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/5tdRP8AAAAAAAAAAAAAAAAAAAAAm11E/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+bXUT//////////////////////5tdRP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/m11E/wAAAAAAAAAAAAAAAAAAAACbXUT/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/oGFG/51eRf+bXUT/m11E/5VZQv//////////////////////lVlC/5tdRP+bXUT/nV5F/6BgRv+jYkj/o2JI/6NiSP+bXUT/AAAAAAAAAAAAAAAAAAAAAJtdRP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+dXkX/kFdA/4tTPf+LUz3/iVE8//////////////////////+JUTz/i1M9/4tTPf+PVj7/ml1E/6JhRv+jYkj/o2JI/5tdRP8AAAAAAAAAAAAAAAAAAAAAm11E/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/5tdRP////////////////////////////////////////////////////////////////+ib1r/oGBG/6NiSP+jYkj/m11E/wAAAAAAAAAAAAAAAAAAAACbXUT/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/m11E/////////////////////////////////////////////////////////////////7qWiP+eX0X/o2JI/6NiSP+bXUT/AAAAAAAAAAAAAAAAAAAAAJtdRP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+dXkX/////////////////////////////////////////////////////////////////18G5/55fRf+jYkj/o2JI/5tdRP8AAAAAAAAAAAAAAAAAAAAAm11E/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6BhRv/////////////////////////////////////////////////////////////////z6+j/oGFG/6NiSP+jYkj/m11E/wAAAAAAAAAAAAAAAAAAAACbXUT/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/5tdRP//////////////////////m11E/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+bXUT/AAAAAAAAAAAAAAAAAAAAAJtdRP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/m11E//////////////////////+YW0P/omFG/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/5tdRP8AAAAAAAAAAAAAAAAAAAAAm11E/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+bXUT//////////////////////5dgS/+YW0P/m11E/5tdRP+dXkX/oGFG/6NiSP+jYkj/m11E/wAAAAAAAAAAAAAAAAAAAACbXUT/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/51eRf/7+fj/////////////////x66k/49bRf+LUz3/i1M9/5BXQP+dXkX/o2JI/6NiSP+bXUT/AAAAAAAAAAAAAAAAAAAAAJtdRP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/n2BF/+3i3v///////////////////////////////////////////5tdRP+jYkj/o2JI/5tdRP8AAAAAAAAAAAAAAAAAAAAAm11E/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+iYUb/zrCk////////////////////////////////////////////m11E/6NiSP+jYkj/m11E/wAAAAAAAAAAAAAAAAAAAACbXUT/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+malH/7eLd//////////////////////////////////////+fX0X/o2JI/6NiSP+bXUT/AAAAAAAAAAAAAAAAAAAAAJtdRP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+maFD/0LGk//Dm4v/7+fj/+/j3//Pr6P/p29X/3ce+/6JhRv+jYkj/o2JI/5tdRP8AAAAAAAAAAAAAAAAAAAAAm11E/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/m11E/wAAAAAAAAAAAAAAAAAAAACXW0P/oGBG/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6BgRv+XW0P/AAAAAAAAAAAAAAAAAAAAAIxTPOaXW0P/m11E/5tdRP+bXUT/m11E/5tdRP+bXUT/m11E/5tdRP+bXUT/m11E/5tdRP+bXUT/m11E/5tdRP+bXUT/m11E/5tdRP+bXUT/m11E/5tdRP+bXUT/m11E/5tdRP+bXUT/l1tD/4xTPOYAAAAAAAAAAAAAAAAAAAAAgUw0SYdPOuaKUz3/i1M9/4tTPf+LUz3/i1M9/4tTPf+LUz3/i1M9/4tTPf+LUz3/i1M9/4tTPf+LUz3/i1M9/4tTPf+LUz3/i1M9/4tTPf+LUz3/i1M9/4tTPf+LUz3/i1M9/4pTPf+HTzrmgUw0SQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////4AAAB8AAAAPAAAADwAAAA8AAAAPAAAADwAAAA8AAAAPAAAADwAAAA8AAAAPAAAADwAAAA8AAAAPAAAADwAAAA8AAAAPAAAADwAAAA8AAAAPAAAADwAAAA8AAAAPAAAADwAAAA8AAAAPAAAAD4AAAB///////////KAAAABAAAAAgAAAAAQAgAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoGBFw6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI////////////o2JI/6NiSP+jYkj/o2JI/6JgR8QAAAAAAAAAAKNiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP///////////6NiSP+jYkj/o2JI/6NiSP+jYkj/AAAAAAAAAACjYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj///////////+jYkj/o2JI/6NiSP+jYkj/o2JI/wAAAAAAAAAAo2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI////////////o2JI/6NiSP+jYkj/o2JI/6NiSP8AAAAAAAAAAKNiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP///////////6NiSP+jYkj/o2JI/6NiSP+jYkj/AAAAAAAAAACjYkj/o2JI/6NiSP+jYkj/o2JI/4JOOv+CTjr///////////+CTjr/gk46/5JYQP+jYkj/o2JI/wAAAAAAAAAAo2JI/6NiSP+jYkj/o2JI/6NiSP/////////////////////////////////HrqT/o2JI/6NiSP8AAAAAAAAAAKNiSP+jYkj/o2JI/6NiSP+jYkj/////////////////////////////////8efj/6NiSP+jYkj/AAAAAAAAAACjYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj///////////+aXUT/o2JI/6NiSP+jYkj/o2JI/wAAAAAAAAAAo2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI//n29f//////pH5v/4JOOv+CTjr/o2JI/6NiSP8AAAAAAAAAAKNiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP/eyL///////////////////////6NiSP+jYkj/AAAAAAAAAACjYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/qm1W/+LOxv/8+/r/9/Hv/+vd2P+jYkj/o2JI/wAAAAAAAAAAm11E/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/5tdRP8AAAAAAAAAAIBNNsOCTjr/gk46/4JOOv+CTjr/gk46/4JOOv+CTjr/gk46/4JOOv+CTjr/gk46/4JOOv+ATTbDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//wAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAD//wAA'; - } -} \ No newline at end of file + public function getIcon() + { + return 'data:image/x-icon;base64,AAABAAIAICAAAAEAIACoEAAAJgAAABAQAAABACAAaAQAAM4QAAAoAAAAIAAAAEAAAAABACAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAlFZBSp5eROejYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+bXUT//////////////////////5tdRP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+eX0TklFZBSgAAAAAAAAAAAAAAAAAAAACZWkLmo2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/5tdRP//////////////////////m11E/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+aW0PnAAAAAAAAAAAAAAAAAAAAAJtdRP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/m11E//////////////////////+bXUT/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/5tdRP8AAAAAAAAAAAAAAAAAAAAAm11E/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+bXUT//////////////////////5tdRP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/m11E/wAAAAAAAAAAAAAAAAAAAACbXUT/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/5tdRP//////////////////////m11E/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+bXUT/AAAAAAAAAAAAAAAAAAAAAJtdRP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/m11E//////////////////////+bXUT/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/5tdRP8AAAAAAAAAAAAAAAAAAAAAm11E/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+bXUT//////////////////////5tdRP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/m11E/wAAAAAAAAAAAAAAAAAAAACbXUT/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/5tdRP//////////////////////m11E/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+bXUT/AAAAAAAAAAAAAAAAAAAAAJtdRP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/m11E//////////////////////+bXUT/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/5tdRP8AAAAAAAAAAAAAAAAAAAAAm11E/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+bXUT//////////////////////5tdRP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/m11E/wAAAAAAAAAAAAAAAAAAAACbXUT/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/oGFG/51eRf+bXUT/m11E/5VZQv//////////////////////lVlC/5tdRP+bXUT/nV5F/6BgRv+jYkj/o2JI/6NiSP+bXUT/AAAAAAAAAAAAAAAAAAAAAJtdRP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+dXkX/kFdA/4tTPf+LUz3/iVE8//////////////////////+JUTz/i1M9/4tTPf+PVj7/ml1E/6JhRv+jYkj/o2JI/5tdRP8AAAAAAAAAAAAAAAAAAAAAm11E/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/5tdRP////////////////////////////////////////////////////////////////+ib1r/oGBG/6NiSP+jYkj/m11E/wAAAAAAAAAAAAAAAAAAAACbXUT/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/m11E/////////////////////////////////////////////////////////////////7qWiP+eX0X/o2JI/6NiSP+bXUT/AAAAAAAAAAAAAAAAAAAAAJtdRP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+dXkX/////////////////////////////////////////////////////////////////18G5/55fRf+jYkj/o2JI/5tdRP8AAAAAAAAAAAAAAAAAAAAAm11E/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6BhRv/////////////////////////////////////////////////////////////////z6+j/oGFG/6NiSP+jYkj/m11E/wAAAAAAAAAAAAAAAAAAAACbXUT/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/5tdRP//////////////////////m11E/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+bXUT/AAAAAAAAAAAAAAAAAAAAAJtdRP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/m11E//////////////////////+YW0P/omFG/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/5tdRP8AAAAAAAAAAAAAAAAAAAAAm11E/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+bXUT//////////////////////5dgS/+YW0P/m11E/5tdRP+dXkX/oGFG/6NiSP+jYkj/m11E/wAAAAAAAAAAAAAAAAAAAACbXUT/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/51eRf/7+fj/////////////////x66k/49bRf+LUz3/i1M9/5BXQP+dXkX/o2JI/6NiSP+bXUT/AAAAAAAAAAAAAAAAAAAAAJtdRP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/n2BF/+3i3v///////////////////////////////////////////5tdRP+jYkj/o2JI/5tdRP8AAAAAAAAAAAAAAAAAAAAAm11E/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+iYUb/zrCk////////////////////////////////////////////m11E/6NiSP+jYkj/m11E/wAAAAAAAAAAAAAAAAAAAACbXUT/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+malH/7eLd//////////////////////////////////////+fX0X/o2JI/6NiSP+bXUT/AAAAAAAAAAAAAAAAAAAAAJtdRP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+maFD/0LGk//Dm4v/7+fj/+/j3//Pr6P/p29X/3ce+/6JhRv+jYkj/o2JI/5tdRP8AAAAAAAAAAAAAAAAAAAAAm11E/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/m11E/wAAAAAAAAAAAAAAAAAAAACXW0P/oGBG/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6BgRv+XW0P/AAAAAAAAAAAAAAAAAAAAAIxTPOaXW0P/m11E/5tdRP+bXUT/m11E/5tdRP+bXUT/m11E/5tdRP+bXUT/m11E/5tdRP+bXUT/m11E/5tdRP+bXUT/m11E/5tdRP+bXUT/m11E/5tdRP+bXUT/m11E/5tdRP+bXUT/l1tD/4xTPOYAAAAAAAAAAAAAAAAAAAAAgUw0SYdPOuaKUz3/i1M9/4tTPf+LUz3/i1M9/4tTPf+LUz3/i1M9/4tTPf+LUz3/i1M9/4tTPf+LUz3/i1M9/4tTPf+LUz3/i1M9/4tTPf+LUz3/i1M9/4tTPf+LUz3/i1M9/4pTPf+HTzrmgUw0SQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////4AAAB8AAAAPAAAADwAAAA8AAAAPAAAADwAAAA8AAAAPAAAADwAAAA8AAAAPAAAADwAAAA8AAAAPAAAADwAAAA8AAAAPAAAADwAAAA8AAAAPAAAADwAAAA8AAAAPAAAADwAAAA8AAAAPAAAAD4AAAB///////////KAAAABAAAAAgAAAAAQAgAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoGBFw6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI////////////o2JI/6NiSP+jYkj/o2JI/6JgR8QAAAAAAAAAAKNiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP///////////6NiSP+jYkj/o2JI/6NiSP+jYkj/AAAAAAAAAACjYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj///////////+jYkj/o2JI/6NiSP+jYkj/o2JI/wAAAAAAAAAAo2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI////////////o2JI/6NiSP+jYkj/o2JI/6NiSP8AAAAAAAAAAKNiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP///////////6NiSP+jYkj/o2JI/6NiSP+jYkj/AAAAAAAAAACjYkj/o2JI/6NiSP+jYkj/o2JI/4JOOv+CTjr///////////+CTjr/gk46/5JYQP+jYkj/o2JI/wAAAAAAAAAAo2JI/6NiSP+jYkj/o2JI/6NiSP/////////////////////////////////HrqT/o2JI/6NiSP8AAAAAAAAAAKNiSP+jYkj/o2JI/6NiSP+jYkj/////////////////////////////////8efj/6NiSP+jYkj/AAAAAAAAAACjYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj///////////+aXUT/o2JI/6NiSP+jYkj/o2JI/wAAAAAAAAAAo2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI//n29f//////pH5v/4JOOv+CTjr/o2JI/6NiSP8AAAAAAAAAAKNiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP/eyL///////////////////////6NiSP+jYkj/AAAAAAAAAACjYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/qm1W/+LOxv/8+/r/9/Hv/+vd2P+jYkj/o2JI/wAAAAAAAAAAm11E/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/6NiSP+jYkj/o2JI/5tdRP8AAAAAAAAAAIBNNsOCTjr/gk46/4JOOv+CTjr/gk46/4JOOv+CTjr/gk46/4JOOv+CTjr/gk46/4JOOv+ATTbDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//wAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAD//wAA'; + } +} diff --git a/src/Sikofitt/Image/Profile/GithubProfileIcon.php b/src/Sikofitt/Image/Profile/GithubProfileIcon.php index 35269f5..4e9ca06 100644 --- a/src/Sikofitt/Image/Profile/GithubProfileIcon.php +++ b/src/Sikofitt/Image/Profile/GithubProfileIcon.php @@ -1,4 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + /** * This file is part of test. * @@ -20,21 +30,24 @@ namespace Sikofitt\Image\Profile; */ class GithubProfileIcon implements ProfileIconInterface { - /** + /** * {@inheritdoc} */ - public function getName() { - return 'github'; + public function getName() + { + return 'github'; } - public function getDefaultUrl() { - return 'https://github.com'; - } + public function getDefaultUrl() + { + return 'https://github.com'; + } /** * {@inheritdoc} */ - public function getIcon() { + public function getIcon() + { return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAYAAADE6YVjAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4AcHEBUg5ZowJwAABmBJREFUSMeVVm1wVOUVft67d7+zjdnNdpcuZJpdgtAwgBiinWkJRhKUII5jM9qOQ8o0teq0HcWUKdNOpx1sRcFOZxxMBacGQgjWQZCiAzEKWgupxaBANo752EzdzX5nN7t7N3vv3vue/kiyiLRKz8zz473nnnPuOc8577nAF6S1tRVEVDpns1lToVBwpNOppYXCTIssy60zMzMbUqmUj4gqpqamjPPvJhIJ/F8SDAYrFEV5iIheLRaLqVBokvz+Yfr440s0/MknFIlGiHM+SURdsizfNzAwYAJwzQfOC/v8IRqNwuVyIZ1ObygvL39KluXVPYd7hffeex/xeBxSPg9N06AXRVjLrHC73WhuWo/W790vAxhIJpPbKisrBwOBAKqrq68PEolE4Ha7kclkHrLZbAdOvvGm8Nvf7YQsy1+aMRHB7rDjud3PYk3drdl0On1vRUXFmfHxcXi9XgCA0N7eDgBwu92YTqe3iKLYveuZ3cKTHdtRKBRARF8KAEgmktjSthUvdx20WSyWd5LJZIPX6y3pGRGBMYZkMtlit9tPPPX7p4Xunh6AgEKhAL3BAKPBcDVnupo/EUGWZahFFWaLGTqdDr948gn8sK0tMzk5+R2Px3M5EAhAYIxhfHTUabfbdx458lfhYPchECc0rF2LvlNv4gfffwBEhLyUhyTloaoqpJyEvJSHXtTjp489inff6UfVoiqoRRW7ntmDf1348Gtut/uP27ZtE0vcSJK0NRGP0/KVq2nZ8pX0Td8SenHfftJUlYiIhvzDNDY6RsQ5ERGpxSIN+f0UGA8QESfinDq2/5J8S5bR0toV9N2GO0hT1Vwmk9kIAEIsGrWYTcb7/9J1AJqqAkQAAblsbrYchQJurlmMqqpFUBQFiixD0zTcXFODhQs9kAsyiAi5bBag2UrG4wkcPXbcWmaxbPT7/XpBVVVLcip158A/PyiRKQgCli+vhaZpICIUi0WoqgrOeQnzz4gIqqpizZo6KEWlRPbp032Qi8qdCz0ei6AoijcSiZgS8cScgYbb6uuwatXKUpCvgqqqaG5ajxqft2QzGQ4jGoktnZqasggmk6kmlUohl5dAADhxeL1emIzGGwowD5PRiGqvF5wIBCAnScjmslBk2SmCyKooCtSiCnCaxVx7cs5v+Boiolk+OQGMoBZVKLKCMqvVJqiqmtOLeuh0OnAQiAHRaAyKLM81wY2hqCiIRGMgBnAQdDod9Ho98pKUETLZ7MhN5eWwWCwAAQIT8OHgRUxPZ264VLP3XgxXrgxBYAJAgNVihdViAec8KXBNm6isdMxUOhwlo9DkJJ7f24mcJEGv14Mx/FfnjDEYDAbE4wnsfHrXNboFC9xwOBzDlU6nJOr1+pzNVtb/7dtvu+fylSEs9HhQW7sMR48dRzgSweZ7WnB7fT0qKiogirqSc0VREIvF8fd/nMOJv53E5aEhGA1GgAicCBuamwBQ/7DfLzEACH32WRuAlxubNzImCHj8Z48hGAyhq7sHZrMZjDGcOPoKXC4XiGbrPTh4EW3tj8Bg0EPTtFIDcM7hWfANnHrjeC6ZTLZW+3ynBAC4MjR0ssxqHfzNr3cgm8ngwMEebGhuQlPjHTCbTFjfuA52hwOc89Jc1NZ+C66vV6KoKCXyiXMwAHue/QMURTlX7fO9BQDiXPrJSxcv/qrl7rtOjoyMins79+G1Y6/jkYfbYbVYAMbAvrD1NE2DrcyGSDQ2q+McOp0OO7Z3YEnN4pR/ePgJANq7Z85AdDqdAIAVt9xy+tJHH215+EdbD4uiiL1/3o9zAwMwm82ou3U1Oh7/OXQ63dW54AROHABB0zQwxrBjewdaNt6FiYmJzWsbGvzz/Anzy/9Mfz9WrFrVG4vHH3z0Jz8uvvj8n5DPF/Dpp6OIhKPgc6vkKmg2kEZY5PHgSHcX7t28KR0MhRrq6uvff6W3F4yx66f2rb4+AMAH5883xiPhgWg4XOx8oZNe2v8SRUIhioXDJYSDQdqz+zk61H2IpuLxfDgY7D/79tsrAKD38OH//SPxednX2Vm+bt26u20222YwNDIwFxOEa7qIMfxb07S+bCZ7Ymtb2+nzFy4o8yX6yiCkqmCiCAA4e/as6abycuvY2Jjd5XRW6Q0Ga6FQyExPT0/4Fi+eDkxMSJs2bVIAYHxkBN6amuv8/QcU+jJuyipKzgAAAABJRU5ErkJggg=='; } -} \ No newline at end of file +} diff --git a/src/Sikofitt/Image/Profile/GitlabProfileIcon.php b/src/Sikofitt/Image/Profile/GitlabProfileIcon.php index 11cad28..f4f5869 100644 --- a/src/Sikofitt/Image/Profile/GitlabProfileIcon.php +++ b/src/Sikofitt/Image/Profile/GitlabProfileIcon.php @@ -1,4 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + /** * This file is part of test. * @@ -18,23 +28,27 @@ namespace Sikofitt\Image\Profile; * Class GitlabProfileIcon * @package Sikofitt\Image\Profile */ -class GitlabProfileIcon implements ProfileIconInterface { +class GitlabProfileIcon implements ProfileIconInterface +{ + + /** + * {@inheritdoc} + */ + public function getName() + { + return 'gitlab'; + } + + public function getDefaultUrl() + { + return 'https://gitlab.com'; + } /** * {@inheritdoc} */ - public function getName() { - return 'gitlab'; + public function getIcon() + { + return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAXCAYAAAD+4+QTAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4AcHECQRchk3rwAAA3VJREFUSMe1lU1oXFUYhp/vnJtJMplJ2iQttElMbCY3uYlaKAqCddEm00K1iFakZFIQoVBciNalRURdueim4MqFYCJ0Uze6sGqhCxcuXCia1JtuatJpuhAUxJ9m7ve5mJnM3PyQZOELF845l/e87/dzzhGasDw5JiLuGvBW39fz8+wCvxUj/jHGzLjS/81Csfmfqw/uHB8jEIeanTSz99gler5aQI1TClPlYjS8qcjgjVtUzIoG7QZHl6fGszsVuHdioj58FUCV5zYVAUB4H8CgB7O+nYocuP4z5WL0MDBc458EWDoepUXKU9F+NZ6oTT3w4m7Spcrr1phOAgzcWEiLqHGsmWQiF3ey+a2nRlkuRi1197VI/N2p8ZkN6TJ4JiVi1luejI5sJ5Lv8JiSNxhax39ns5o8vyEF8Mp2In3X5wGeBVpTIjB0dyoauHNshABg6enohCq56r8GEji6o4IYb5vV914TcaY8PnhzcSkAOHg+uSQ/AQ/WcY3DS0Fkplvv71vgQJSApQwKDrNxXuImnzmbDbtNOKyHUE2Q5g+D7F5LzLYWyXapagVS3ApohFkbZwFcAiNAnhyOAkmzHzPo3KeyzmUKmRyyLnXwEEo7DoNkLjzrBF6Aqmu68fSizVuKx2WyW4u0tltaoAulvypQW7vogFMpVgFHG9pMbO0w2aTYZLssEdcUSRtGiJA0dzKPORwvi/Brys0j1cKtcfO2IWEG5PaZNNXLGMVwqfTdF88Z56fj751LhkS41mgZhBCtO2rNmaxv7yCDBRlrnLNRoK1x7sTxnTiG/XT8havGFJific+I4wJSa+Q9eAZraTOko8dStcpkazEosB9lTyMCcbzhS/GTvhT/Ve3nGiqfFAjO3Sb5NDyI8oMZvQjwI8rfOK2gK794h1S7rntAtb3THHkSJvAoINxD7EhQWlzZ9KoPzt0mmQvx03FZHH3iuAy1+rRi4nE+Q/1cW7bTBMEYQVAQ4Yp3hEFpcWV1doQt3xNfiuvDB74UvynCaYTfKSAi0NJWbYDsXlME4VGghX+957yfiV9LjD8BWmYWtxZZW5yOSWZDfCn+3DkKkudbRqGjy8wMct3qrB8ky6LAIZmOP7Kr4wQNk7uDzoXVy3I2/EDfDVeXi5GuXgpNr4aX+T9gX4YTf1wYvV/5MFx71Fc/LmzL+w9fiFeX9RDTWwAAAABJRU5ErkJggg=='; } - - public function getDefaultUrl() { - return 'https://gitlab.com'; - } - - /** - * {@inheritdoc} - */ - public function getIcon() { - return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAXCAYAAAD+4+QTAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4AcHECQRchk3rwAAA3VJREFUSMe1lU1oXFUYhp/vnJtJMplJ2iQttElMbCY3uYlaKAqCddEm00K1iFakZFIQoVBciNalRURdueim4MqFYCJ0Uze6sGqhCxcuXCia1JtuatJpuhAUxJ9m7ve5mJnM3PyQZOELF845l/e87/dzzhGasDw5JiLuGvBW39fz8+wCvxUj/jHGzLjS/81Csfmfqw/uHB8jEIeanTSz99gler5aQI1TClPlYjS8qcjgjVtUzIoG7QZHl6fGszsVuHdioj58FUCV5zYVAUB4H8CgB7O+nYocuP4z5WL0MDBc458EWDoepUXKU9F+NZ6oTT3w4m7Spcrr1phOAgzcWEiLqHGsmWQiF3ey+a2nRlkuRi1197VI/N2p8ZkN6TJ4JiVi1luejI5sJ5Lv8JiSNxhax39ns5o8vyEF8Mp2In3X5wGeBVpTIjB0dyoauHNshABg6enohCq56r8GEji6o4IYb5vV914TcaY8PnhzcSkAOHg+uSQ/AQ/WcY3DS0Fkplvv71vgQJSApQwKDrNxXuImnzmbDbtNOKyHUE2Q5g+D7F5LzLYWyXapagVS3ApohFkbZwFcAiNAnhyOAkmzHzPo3KeyzmUKmRyyLnXwEEo7DoNkLjzrBF6Aqmu68fSizVuKx2WyW4u0tltaoAulvypQW7vogFMpVgFHG9pMbO0w2aTYZLssEdcUSRtGiJA0dzKPORwvi/Brys0j1cKtcfO2IWEG5PaZNNXLGMVwqfTdF88Z56fj751LhkS41mgZhBCtO2rNmaxv7yCDBRlrnLNRoK1x7sTxnTiG/XT8havGFJific+I4wJSa+Q9eAZraTOko8dStcpkazEosB9lTyMCcbzhS/GTvhT/Ve3nGiqfFAjO3Sb5NDyI8oMZvQjwI8rfOK2gK794h1S7rntAtb3THHkSJvAoINxD7EhQWlzZ9KoPzt0mmQvx03FZHH3iuAy1+rRi4nE+Q/1cW7bTBMEYQVAQ4Yp3hEFpcWV1doQt3xNfiuvDB74UvynCaYTfKSAi0NJWbYDsXlME4VGghX+957yfiV9LjD8BWmYWtxZZW5yOSWZDfCn+3DkKkudbRqGjy8wMct3qrB8ky6LAIZmOP7Kr4wQNk7uDzoXVy3I2/EDfDVeXi5GuXgpNr4aX+T9gX4YTf1wYvV/5MFx71Fc/LmzL+w9fiFeX9RDTWwAAAABJRU5ErkJggg=='; - } -} \ No newline at end of file +} diff --git a/src/Sikofitt/Image/Profile/LinkedinProfileIcon.php b/src/Sikofitt/Image/Profile/LinkedinProfileIcon.php index 31cd0c6..0d44e74 100644 --- a/src/Sikofitt/Image/Profile/LinkedinProfileIcon.php +++ b/src/Sikofitt/Image/Profile/LinkedinProfileIcon.php @@ -1,4 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + /** * This file is part of test. * @@ -14,18 +24,21 @@ namespace Sikofitt\Image\Profile; +class LinkedinProfileIcon implements ProfileIconInterface +{ -class LinkedinProfileIcon implements ProfileIconInterface { + public function getName() + { + return 'linkedin'; + } - public function getName() { - return 'linkedin'; - } + public function getDefaultUrl() + { + return 'https://linkedin.com/in'; + } - public function getDefaultUrl() { - return 'https://linkedin.com/in'; - } - - public function getIcon() { - return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAYAAADE6YVjAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4AcHETMTmFa4IgAAA/1JREFUSMeVlk2IXEUQx3/V783sfOxKdjeKQqImCJpsBC9qwFxC1KCiEW8eRQVBPXjxInjwJoin6CXEsyhCcvIDRUQkGoOgyaJgPlAS2GQlX7tmZ3fm1d9D93tvZnZzsKHpnqrurqp//aveGMDk7qdnWlt37DSzhrDcwABE2qQ9lcJKSTUEmNWX5N5bPXfy1NKJzy/n3YeempnZ/9Lh0J58BrNQPmxYekbUTxpChLSOGwnJC0kg0Znbc5SJzouhfefOXaE9+SwQJDAJSbgcKPfxkuSYiLokQ4BUyd2jToC1ugead2yfy2WhJQIux0wUDjf6BQImmxm2DrYUXxVe0lpcJVVnMQMLrSCgSFcHLu6e6XDmzb2ceH0PU60GnmDzBJynvWtYJiTDUwTCRmaQQC7cRWaBL154kE2tnO3TbQ49d38M3eN0OUpwyoUE7l7rvIa3hE4SuZJXAJu7TbrNrErmbKdBMwusDKLP46ySJ2iSWIqEibkECxGFUHrmLv5cXOLI/CVIhj87ucC1Xj95Fc946akLIZyx3+6RKOXeRe4SRRK2mhmvHPmNg8em6Lvz+6VlQrB0yWI2VFOgKEQhyIKRGeDGEN8RQiZyIgMp163Tba71Bgi4rTvBwtIqjWBs3dTGESt9Z+F6j9luk913zXD71ASnF5f5Y3GZxX/XIhuSITNDDnmkewz16kqff95+rML85/NX2XfoR7ZNT3L8tUcAOH7+Gu9/f44PDswx22lUZ6/3Brzz7WkO//QXWQgJ8uh9ZJcMFRGNQnVie33HCyi8ruwdt3b5+PkHRgwA3NLKee+J+9iyqUNRCC8EHiMJoqzu2vJwqxguQICpiRyAT04u8O53Zzj295WRO2/tu4cbawPKd2UiL2vEyhYxZqZwj14NjY9+ucCrn/7KRCPwYbvJVy8/zL2buwDs3TbL2sBp5QFLfSyUPcCHGUBNBAGyUfnBH86SZYYLLi71uLi0WummW3nVu8quk8eqjbVSVeXQcBfyUdmFKyup+ERJnHLkmYGr7p+q2LUBUkPRjOeqKOoedbM8uupPRF2MG0RSGhjqq1U3cK+rWuMepjxj8X5VJ+tPloaE3NfJqoreAGJSq6ogLGP04U45Hs06ztUQymwD1yxFb2UkYjCUGHdBSNh7lJXeFhKZGYWXDRFwp3BVRewePS7cMTOQYfbkG4+HXfu+jL1GDG70a4eCkU3k8YHeoAojpGovYyhWByMoZJ1GbPVm6NQ3+3Pce0pemSC0GmMsgUCAVmMELw2dCc28+pNhUFE+5bMXWDw7773lo/HbQDU1NH1Mt16fSDByRnhv+agWz87HiOcenWHL3C6CtW5aMP9nGODqcX7+FPNfX/4PZFb8sTBvluQAAAAASUVORK5CYII='; - } -} \ No newline at end of file + public function getIcon() + { + return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAYAAADE6YVjAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4AcHETMTmFa4IgAAA/1JREFUSMeVlk2IXEUQx3/V783sfOxKdjeKQqImCJpsBC9qwFxC1KCiEW8eRQVBPXjxInjwJoin6CXEsyhCcvIDRUQkGoOgyaJgPlAS2GQlX7tmZ3fm1d9D93tvZnZzsKHpnqrurqp//aveGMDk7qdnWlt37DSzhrDcwABE2qQ9lcJKSTUEmNWX5N5bPXfy1NKJzy/n3YeempnZ/9Lh0J58BrNQPmxYekbUTxpChLSOGwnJC0kg0Znbc5SJzouhfefOXaE9+SwQJDAJSbgcKPfxkuSYiLokQ4BUyd2jToC1ugead2yfy2WhJQIux0wUDjf6BQImmxm2DrYUXxVe0lpcJVVnMQMLrSCgSFcHLu6e6XDmzb2ceH0PU60GnmDzBJynvWtYJiTDUwTCRmaQQC7cRWaBL154kE2tnO3TbQ49d38M3eN0OUpwyoUE7l7rvIa3hE4SuZJXAJu7TbrNrErmbKdBMwusDKLP46ySJ2iSWIqEibkECxGFUHrmLv5cXOLI/CVIhj87ucC1Xj95Fc946akLIZyx3+6RKOXeRe4SRRK2mhmvHPmNg8em6Lvz+6VlQrB0yWI2VFOgKEQhyIKRGeDGEN8RQiZyIgMp163Tba71Bgi4rTvBwtIqjWBs3dTGESt9Z+F6j9luk913zXD71ASnF5f5Y3GZxX/XIhuSITNDDnmkewz16kqff95+rML85/NX2XfoR7ZNT3L8tUcAOH7+Gu9/f44PDswx22lUZ6/3Brzz7WkO//QXWQgJ8uh9ZJcMFRGNQnVie33HCyi8ruwdt3b5+PkHRgwA3NLKee+J+9iyqUNRCC8EHiMJoqzu2vJwqxguQICpiRyAT04u8O53Zzj295WRO2/tu4cbawPKd2UiL2vEyhYxZqZwj14NjY9+ucCrn/7KRCPwYbvJVy8/zL2buwDs3TbL2sBp5QFLfSyUPcCHGUBNBAGyUfnBH86SZYYLLi71uLi0WummW3nVu8quk8eqjbVSVeXQcBfyUdmFKyup+ERJnHLkmYGr7p+q2LUBUkPRjOeqKOoedbM8uupPRF2MG0RSGhjqq1U3cK+rWuMepjxj8X5VJ+tPloaE3NfJqoreAGJSq6ogLGP04U45Hs06ztUQymwD1yxFb2UkYjCUGHdBSNh7lJXeFhKZGYWXDRFwp3BVRewePS7cMTOQYfbkG4+HXfu+jL1GDG70a4eCkU3k8YHeoAojpGovYyhWByMoZJ1GbPVm6NQ3+3Pce0pemSC0GmMsgUCAVmMELw2dCc28+pNhUFE+5bMXWDw7773lo/HbQDU1NH1Mt16fSDByRnhv+agWz87HiOcenWHL3C6CtW5aMP9nGODqcX7+FPNfX/4PZFb8sTBvluQAAAAASUVORK5CYII='; + } +} diff --git a/src/Sikofitt/Image/Profile/ProfileIconInterface.php b/src/Sikofitt/Image/Profile/ProfileIconInterface.php index 1489c36..0faefff 100644 --- a/src/Sikofitt/Image/Profile/ProfileIconInterface.php +++ b/src/Sikofitt/Image/Profile/ProfileIconInterface.php @@ -1,4 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + /** * This file is part of resume. * @@ -18,9 +28,10 @@ namespace Sikofitt\Image\Profile; * Interface ProfileIconInterface * @package Sikofitt\Image\Profile */ -interface ProfileIconInterface { +interface ProfileIconInterface +{ - /** + /** * @return string * The name of the network. */ @@ -38,5 +49,4 @@ interface ProfileIconInterface { * Can be a url, a relative path, or base64 encoded uri. */ public function getIcon(); - -} \ No newline at end of file +} diff --git a/src/Sikofitt/Image/Profile/TwitterProfileIcon.php b/src/Sikofitt/Image/Profile/TwitterProfileIcon.php index 7392aa6..c0eaf19 100644 --- a/src/Sikofitt/Image/Profile/TwitterProfileIcon.php +++ b/src/Sikofitt/Image/Profile/TwitterProfileIcon.php @@ -1,4 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + /** * This file is part of resume. * @@ -14,19 +24,20 @@ namespace Sikofitt\Image\Profile; +class TwitterProfileIcon implements ProfileIconInterface +{ -class TwitterProfileIcon implements ProfileIconInterface { + public function getName() + { + return 'twitter'; + } + public function getDefaultUrl() + { + return 'https://twitter.com'; + } - public function getName() - { - return 'twitter'; - } - public function getDefaultUrl() { - return 'https://twitter.com'; - } - - public function getIcon() { - return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAYAAADE6YVjAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4AcHEBgWn47b8wAAAedJREFUSMfllj1LHEEYgJ/du/hxCYOkCXIOwSJdhIQUAZGYwtJGsVA4mFb8ARYGo5WQgCmSOsVgJfgLrAImZfQHWCg3mNjYDJxwp5e1mdNhsnu74bSJb7PszDvvs+/nLPwvEoULUluMEl0PdXSktn1A7JYToAUk/nmp7Q1EahsDkVGinQOIjBKJ1LYGLAH9busPsGWU+Cy1HQLmgH2jxH7UoQFDwAnwEEj1xvNgGfiQ8g2Jg0XOw6dGiXrsGawBFeAUmPDg1+IALx0gyQh/yQE2gA2pbSX2FJ655xNgT2q7npGb6ax8Bh6tAJtGiXMfsh0orkltL6S281LbqtT2gRf7PGkDL4wSB9eJd2EpAYfAaMqh38AZ0ABGgGoO5CcwDrSMEvg5mQEOMmI9DDwHXhcAADT94ikHhmZvqf++GyVanZfYC5e+qyb3w2WBj1519CJf88bKJPCtB8CeUeLNX54EstujF7VwIQ0y3wNgyyhRDydFlDGbFoFV4DEwUBBwCrwCfoWTIuoyBCNgp2BZN4Axo8RR2mbZGS4Dgw5akdrOAV8KemCASeA4S6HTjAPAJrAAPCpovAm8Bz4ZJS5zm8YL0VvgHTDVpVfqLsGr/9yZ4bUrtR0Pxg5A2yjxw78h7+SnICzP+yVXFk+tI1UN56QAAAAASUVORK5CYII='; - } - -} \ No newline at end of file + public function getIcon() + { + return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAYAAADE6YVjAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4AcHEBgWn47b8wAAAedJREFUSMfllj1LHEEYgJ/du/hxCYOkCXIOwSJdhIQUAZGYwtJGsVA4mFb8ARYGo5WQgCmSOsVgJfgLrAImZfQHWCg3mNjYDJxwp5e1mdNhsnu74bSJb7PszDvvs+/nLPwvEoULUluMEl0PdXSktn1A7JYToAUk/nmp7Q1EahsDkVGinQOIjBKJ1LYGLAH9busPsGWU+Cy1HQLmgH2jxH7UoQFDwAnwEEj1xvNgGfiQ8g2Jg0XOw6dGiXrsGawBFeAUmPDg1+IALx0gyQh/yQE2gA2pbSX2FJ655xNgT2q7npGb6ax8Bh6tAJtGiXMfsh0orkltL6S281LbqtT2gRf7PGkDL4wSB9eJd2EpAYfAaMqh38AZ0ABGgGoO5CcwDrSMEvg5mQEOMmI9DDwHXhcAADT94ikHhmZvqf++GyVanZfYC5e+qyb3w2WBj1519CJf88bKJPCtB8CeUeLNX54EstujF7VwIQ0y3wNgyyhRDydFlDGbFoFV4DEwUBBwCrwCfoWTIuoyBCNgp2BZN4Axo8RR2mbZGS4Dgw5akdrOAV8KemCASeA4S6HTjAPAJrAAPCpovAm8Bz4ZJS5zm8YL0VvgHTDVpVfqLsGr/9yZ4bUrtR0Pxg5A2yjxw78h7+SnICzP+yVXFk+tI1UN56QAAAAASUVORK5CYII='; + } +} diff --git a/src/Sikofitt/Json/JsonFileTrait.php b/src/Sikofitt/Json/JsonFileTrait.php new file mode 100644 index 0000000..392c7a9 --- /dev/null +++ b/src/Sikofitt/Json/JsonFileTrait.php @@ -0,0 +1,39 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/** + * This file is part of test. + * + * @file JsonFileTrait.php + * + * R. Eric Wheeler + * + * 7/8/16 / 8:12 AM + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Sikofitt\Json; + +trait JsonFileTrait +{ + + public function encodeFile($array, $file, $schema = null) + { + return $this['json.encode']->encodeFile($array, $file, $schema); + } + + public function decodeFile($file, $schema = null) + { + return $this['json.decode']->decodeFile($file, $file, $schema); + } +} diff --git a/src/Sikofitt/Json/JsonServiceProvider.php b/src/Sikofitt/Json/JsonServiceProvider.php new file mode 100644 index 0000000..fb91636 --- /dev/null +++ b/src/Sikofitt/Json/JsonServiceProvider.php @@ -0,0 +1,42 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Sikofitt\Json; + +use Pimple\Container; +use Pimple\ServiceProviderInterface; +use Webmozart\Json\JsonDecoder; +use Webmozart\Json\JsonEncoder; +use Webmozart\Json\JsonValidator; + +/** + * Class JsonServiceProvider + * @package Sikofitt\Json + */ +class JsonServiceProvider implements ServiceProviderInterface +{ + + /** + * @param Container $app + */ + public function register(Container $app) + { + $app['json.encode'] = function ($app) { + return new JsonEncoder(); + }; + $app['json.decode'] = function ($app) { + return new JsonDecoder(); + }; + $app['json.validate'] = function ($app) { + return new JsonValidator(); + }; + } +} diff --git a/src/Sikofitt/Json/JsonTrait.php b/src/Sikofitt/Json/JsonTrait.php new file mode 100644 index 0000000..90e3625 --- /dev/null +++ b/src/Sikofitt/Json/JsonTrait.php @@ -0,0 +1,50 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Sikofitt\Json; + +/** + * Class JsonTrait + * @package Sikofitt\Json + */ +trait JsonTrait +{ + + /** + * @param $array + * @param null $schema + * @return mixed + */ + public function encode($array, $schema = null) + { + return $this['json.encode']->encode($array, $schema); + } + + /** + * @param $json + * @param null $schema + * @return mixed + */ + public function decode($json, $schema = null) + { + return $this['json.decode']->decode($json, $schema); + } + + /** + * @param $json + * @param $schema + * @return mixed + */ + public function validate($json, $schema) + { + return $this['json.validate']->validate($json, $schema); + } +} diff --git a/src/Sikofitt/Json/ResumeBuilder.php b/src/Sikofitt/Json/ResumeBuilder.php index 0b55be1..87ab20a 100644 --- a/src/Sikofitt/Json/ResumeBuilder.php +++ b/src/Sikofitt/Json/ResumeBuilder.php @@ -1,4 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + /** * Created by PhpStorm. * User: eric @@ -8,17 +18,16 @@ namespace Sikofitt\Json; - - -use Webmozart\Json\JsonDecoder; -use Webmozart\Json\JsonEncoder; +use App; use Webmozart\Json\DecodingFailedException; use Webmozart\Json\EncodingFailedException; -use Webmozart\Json\JsonValidator; -use Webmozart\Json\ValidationFailedException; use Webmozart\Json\FileNotFoundException; use Webmozart\Json\IOException; -use App; +use Webmozart\Json\JsonDecoder; +use Webmozart\Json\JsonEncoder; +use Webmozart\Json\JsonValidator; +use Webmozart\Json\ValidationFailedException; + /** * Class ResumeBuilder * @package Sikofitt\Json @@ -27,38 +36,34 @@ class ResumeBuilder { private $app; - public function __construct (App $app) + public function __construct(App $app) { $this->app = $app; } - public function toJson ($resumeArray, array $options = array ()) + public function toJson($resumeArray, array $options = []) { $encoder = new JsonEncoder(); $validator = new JsonValidator(); - if(!isset($options['file'])) { + if (!isset($options['file'])) { throw new \InvalidArgumentException('file is a required argument.'); } $errors = $validator->validate((object)$resumeArray, $options['app']->getResumeSchema()); dump($errors); try { - // $encoder->encodeFile ($resumeArray, 'test.json'); - + // $encoder->encodeFile ($resumeArray, 'test.json'); } catch (\Exception $e) { $r = new \ReflectionClass($e); $exceptionClass = $r->getName(); return new $exceptionClass($e->getMessage()); } - - - } - public function fromJson ($resumeJson, array $options = array ()) + public function fromJson($resumeJson, array $options = []) { $decoder = new JsonDecoder(); $resumeObject = $decoder->decodeFile($this->app->getResumeJson(), $this->app->getResumeSchema()); return $resumeObject; } -} \ No newline at end of file +} diff --git a/src/Sikofitt/Resume/ResumeParser.php b/src/Sikofitt/Resume/ResumeParser.php index c6a068a..c13ea7c 100644 --- a/src/Sikofitt/Resume/ResumeParser.php +++ b/src/Sikofitt/Resume/ResumeParser.php @@ -1,4 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + /** * Created by PhpStorm. * User: eric @@ -8,7 +18,6 @@ namespace Sikofitt\Resume; - use Webmozart\Json\Conversion\JsonConverter; /** @@ -23,7 +32,7 @@ class ResumeParser implements JsonConverter * * @return void */ - public function fromJson ($jsonData, array $options = array ()) + public function fromJson($jsonData, array $options = []) { // TODO: Implement fromJson() method. } @@ -34,10 +43,8 @@ class ResumeParser implements JsonConverter * * @return void */ - public function toJson ($data, array $options = array ()) + public function toJson($data, array $options = []) { // TODO: Implement toJson() method. } - - -} \ No newline at end of file +} diff --git a/src/Sikofitt/Twig/Date.php b/src/Sikofitt/Twig/Date.php index bb38309..c759603 100644 --- a/src/Sikofitt/Twig/Date.php +++ b/src/Sikofitt/Twig/Date.php @@ -1,4 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + /** * This file is part of resume. * @@ -14,12 +24,13 @@ namespace Sikofitt\Twig; +class Date extends \Twig_Extension +{ -class Date extends \Twig_Extension { - - public function getName() { - return 'date_diff'; - } + public function getName() + { + return 'date_diff'; + } /** * @return array @@ -27,7 +38,7 @@ class Date extends \Twig_Extension { */ public function getFilters() { - return [ + return [ new \Twig_SimpleFilter('date_diff', [$this, 'dateDiff']), ]; } @@ -42,9 +53,8 @@ class Date extends \Twig_Extension { */ public function dateDiff($startDate, $endDate = 'now') { - $dt = new \DateTimeImmutable($startDate); - $dateDifference = $dt->diff(new \DateTime($endDate)); - return $dateDifference->format('%y years'); - + $dt = new \DateTimeImmutable($startDate); + $dateDifference = $dt->diff(new \DateTime($endDate)); + return $dateDifference->format('%y years'); } -} \ No newline at end of file +} diff --git a/src/Sikofitt/Twig/RenderProfile.php b/src/Sikofitt/Twig/RenderProfile.php index 6eb7b66..4b808ee 100644 --- a/src/Sikofitt/Twig/RenderProfile.php +++ b/src/Sikofitt/Twig/RenderProfile.php @@ -1,4 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + /** * This file is part of test. * @@ -14,41 +24,42 @@ namespace Sikofitt\Twig; +class RenderProfile extends \Twig_Extension +{ -class RenderProfile extends \Twig_Extension { + public function getName() + { + return 'render_profile'; + } - public function getName() { - return 'render_profile'; - } - - public function getFunctions() { - return [ + public function getFunctions() + { + return [ new \Twig_SimpleFunction('render_profile', [$this, 'renderProfile'], ['needs_context' => true]), ]; - } + } - public function renderProfile($context, $iconData) - { - $imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAIAAABLixI0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4AcHEQYsjAFXqQAAAEVpVFh0Q29tbWVudAAAAAAAQ1JFQVRPUjogZ2QtanBlZyB2MS4wICh1c2luZyBJSkcgSlBFRyB2ODApLCBxdWFsaXR5ID0gOTAKqozFDgAAAiVJREFUOMutlT/oOWEcx+8OX5fLDVwx2ZQFSQYzmZgMzCaDzaCUMpmQkowM2G+gFFnUGXRKSQwGIYtyisif+w2n+973ucef4fde7u75fD6v5/l8Ps/zHMLDxHFcp9OJxWJOp1Ov1ysUChzHLRZLNBrt9Xrn8xkahciH6vW6VqtFXouiqOFw+JmVz+eR79Rqtd6xSqUS8rUwDGNZFs7a7/c4jku9lUplOByuVqvtdpum6Xg8jqKo1MHn88FZHo8HmPnn50co8+PxeLVwjuNA1mq1giaSTCaDwaDX653P58+Av6pUKiJLKQxNJhMUReWumUxGeGFZ1mw2yydbLpe/FRQeh8NBDhJFkmQgEEAQJJ1OAyaDwfD7ISyv2+0CdZV2YL1e8zw/Go3UajXQSkjtj8fjK1YkEnmWQ6kETEajUcp65qjRaAqFApRls9kQBBkMBrfbDTBtt9tGowHmKMhqtUJzJAhCpVJBZ9LpdKfTCbLvGYaRe2ez2d1uV6vV5CahLAzDwM9jIpEAAjabDXRnCSqXy5fLBc46HA4kSUq9c7kcz/PQdQElAlnX69XhcHx5vP1+P6SP0i0DnPD3rD+xgPnxeJhMpm9AKIra7faXCYtaLBYURUHjRWEYJnbw5R0t6HK5hEIhKYggiGazOZ1O+/1+u90ej8ef73up3G63yEqlUu+dP7Du97vL5RL+F/wnIR89ZrMZhmHFYvE/sHiep2lavFff6B8xFGrMmf/uPQAAAABJRU5ErkJggg=='; + public function renderProfile($context, $iconData) + { + $imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAIAAABLixI0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4AcHEQYsjAFXqQAAAEVpVFh0Q29tbWVudAAAAAAAQ1JFQVRPUjogZ2QtanBlZyB2MS4wICh1c2luZyBJSkcgSlBFRyB2ODApLCBxdWFsaXR5ID0gOTAKqozFDgAAAiVJREFUOMutlT/oOWEcx+8OX5fLDVwx2ZQFSQYzmZgMzCaDzaCUMpmQkowM2G+gFFnUGXRKSQwGIYtyisif+w2n+973ucef4fde7u75fD6v5/l8Ps/zHMLDxHFcp9OJxWJOp1Ov1ysUChzHLRZLNBrt9Xrn8xkahciH6vW6VqtFXouiqOFw+JmVz+eR79Rqtd6xSqUS8rUwDGNZFs7a7/c4jku9lUplOByuVqvtdpum6Xg8jqKo1MHn88FZHo8HmPnn50co8+PxeLVwjuNA1mq1giaSTCaDwaDX653P58+Av6pUKiJLKQxNJhMUReWumUxGeGFZ1mw2yydbLpe/FRQeh8NBDhJFkmQgEEAQJJ1OAyaDwfD7ISyv2+0CdZV2YL1e8zw/Go3UajXQSkjtj8fjK1YkEnmWQ6kETEajUcp65qjRaAqFApRls9kQBBkMBrfbDTBtt9tGowHmKMhqtUJzJAhCpVJBZ9LpdKfTCbLvGYaRe2ez2d1uV6vV5CahLAzDwM9jIpEAAjabDXRnCSqXy5fLBc46HA4kSUq9c7kcz/PQdQElAlnX69XhcHx5vP1+P6SP0i0DnPD3rD+xgPnxeJhMpm9AKIra7faXCYtaLBYURUHjRWEYJnbw5R0t6HK5hEIhKYggiGazOZ1O+/1+u90ej8ef73up3G63yEqlUu+dP7Du97vL5RL+F/wnIR89ZrMZhmHFYvE/sHiep2lavFff6B8xFGrMmf/uPQAAAABJRU5ErkJggg=='; //network": "Twitter" +"username": "sikofitt" +"url": "" $icons = $context['app']->config('app.icons'); - $network = strtolower($iconData->network); - $haveNetwork = isset($icons[$network]); - if($haveNetwork) { - $imageData = $icons[strtolower($iconData->network)]; - } else { - return; + $network = strtolower($iconData->network); + $haveNetwork = isset($icons[$network]); + if ($haveNetwork) { + $imageData = $icons[strtolower($iconData->network)]; + } else { + return; + } + if (!isset($iconData->url) || empty($iconData->url)) { + $iconData->url = $icons[strtolower($iconData->network)]['url'] . '/' . $iconData->username; + } + $imageUrl = sprintf('%s', $imageData['icon'], $iconData->network); + if (isset($iconData->url) && !empty($iconData->url)) { + return sprintf('%s', $iconData->url, $iconData->network, $imageUrl); + } else { + return $imageUrl; + } } - if(!isset($iconData->url) || empty($iconData->url)) - { - $iconData->url = $icons[strtolower($iconData->network)]['url'] . '/' . $iconData->username; - } - $imageUrl = sprintf('%s', $imageData['icon'], $iconData->network); - if(isset($iconData->url) && !empty($iconData->url)) { - return sprintf('%s', $iconData->url, $iconData->network,$imageUrl); - } else { - return $imageUrl; - } - } -} \ No newline at end of file +} diff --git a/src/Sikofitt/less/resume.less b/src/Sikofitt/less/resume.less index e202587..6cd3e96 100644 --- a/src/Sikofitt/less/resume.less +++ b/src/Sikofitt/less/resume.less @@ -1,4 +1,5 @@ @import 'uikit.less'; +@import 'components/notify.less'; @import 'https://fonts.googleapis.com/css?family=Lato:300|Eczar'; @base-body-font-family : 'Lato'; diff --git a/web/index.php b/web/index.php index 4301a9c..8d1abd2 100644 --- a/web/index.php +++ b/web/index.php @@ -1,106 +1,20 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ require_once __DIR__ . '/../vendor/autoload.php'; -require_once __DIR__ . '/../app/App.php'; -define('APP_ROOT', __DIR__ . '/../'); -define('SCHEMA_URL', 'https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/schema.json'); $app = new App(); -$app['debug'] = true; -$app->register(new Sikofitt\Config\ConfigServiceProvider(), [ - 'config.path' => $app->getConfDirectory(), -]); -$app->register(new TwigServiceProvider(), [ - 'twig.path' => [ - APP_ROOT . 'app/views', - APP_ROOT . 'vendor/symfony/web-profiler-bundle/Resources/views/Profiler' - ], -]); -$app->register(new WhoopsServiceProvider()); -$app->register(new \Silex\Provider\AssetServiceProvider()); -$app->register(new \Silex\Provider\MonologServiceProvider()); - -$app->register(new \Silex\Provider\HttpKernelServiceProvider()); -$app->register(new \Silex\Provider\AssetServiceProvider()); -$app->register(new \Silex\Provider\FormServiceProvider()); -$app->register(new \Silex\Provider\HttpFragmentServiceProvider()); -$app->register(new \Silex\Provider\ServiceControllerServiceProvider()); -$app->register(new \Silex\Provider\RoutingServiceProvider()); -$app->register(new \Silex\Provider\VarDumperServiceProvider(), array( - 'var_dumper.dump_destination' => new \Symfony\Component\VarDumper\Cloner\VarCloner(), -)); - -$app->register(new \Silex\Provider\MonologServiceProvider(), array( - 'monolog.logfile' => $app->getDataDirectory() . '/logs/' . (null !== $app->config('app.environment') ? $app->config('app.environment') . '.log' : 'dev.log'), -)); - -$app->register(new \Silex\Provider\SessionServiceProvider()); -$app->register(new \Silex\Provider\WebProfilerServiceProvider(), array( - 'profiler.cache_dir' => $app->getDataDirectory() . '/cache/profiler', -)); -$app->extend('twig', function (\Twig_Environment $twig, $app) { - $twig->enableDebug(); - $twig->addExtension(new Twig_Extensions_Extension_Date()); - $twig->addExtension(new Sikofitt\Twig\Date()); - $twig->addExtension(new Sikofitt\Twig\RenderProfile()); - $twig->addGlobal('config', $app['config']->all()); - return $twig; -}); -$app->error(function (\Exception $e, $code) use ($app) { - switch ($code) { - case 404: - $message = $app['twig']->render('error404.html.twig'); - break; - default: - $message = $app['twig']->render('error500.html.twig'); - } - return new Response($message, $code); -}); - -$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) { - $resumeData = $app['json.decoder']->decodeFile($app->getDataDirectory() . '/resume.json', $app->getDataDirectory() . '/resume.schema.json'); - $basics = (isset($resumeData->basics) && count($resumeData->basics) > 0) ? $resumeData->basics : null; - $work = (isset($resumeData->work) && count($resumeData->work) > 0) ? $resumeData->work : null; - $volunteer = (isset($resumeData->volunteer) && count($resumeData->volunteer) > 0) ? $resumeData->volunteer : null; - $education = (isset($resumeData->education) && count($resumeData->education) > 0) ? $resumeData->education : null; - $awards = (isset($resumeData->awards) && count($resumeData->awards) > 0) ? $resumeData->awards : null; - $publications = (isset($resumeData->publications) && count($resumeData->publications) > 0) ? $resumeData->publications : null; - $skills = (isset($resumeData->skills) && count($resumeData->skills) > 0) ? $resumeData->skills : null; - $languages = (isset($resumeData->languages) && count($resumeData->languages) > 0) ? $resumeData->languages : null; - $interests = (isset($resumeData->interests) && count($resumeData->interests) > 0) ? $resumeData->interests : null; - $references = (isset($resumeData->references) && count($resumeData->references) > 0) ? $resumeData->references : null; - - - return $app['twig']->render('resume.html.twig', [ - 'basics' => $basics, - 'work' => $work, - 'volunteer' => $volunteer, - 'education' => $education, - 'awards' => $awards, - 'publications' => $publications, - 'skills' => $skills, - 'languages' => $languages, - 'interests' => $interests, - 'references' => $references, - ]); -}); +require_once $app->getAppDirectory() . '/providers.php'; +$app->mount('/', new \Sikofitt\Controller\ResumeControllerProvider()); +$app->mount('/api', new \Sikofitt\Controller\ApiControllerProvider()); $app->run();