From 24f1a18dfc128d2c0ce0530d1da44c8e3cc8fa5c Mon Sep 17 00:00:00 2001 From: Eric Wheeler Date: Sat, 9 Jul 2016 21:37:39 -0700 Subject: [PATCH] php-cs-fixer --- .idea/workspace.xml | 241 +++++----- app/App.php | 29 +- app/views/resume.html.twig | 421 +++++++++--------- package.json | 2 +- .../Controller/ApiControllerProvider.php | 54 ++- 5 files changed, 377 insertions(+), 370 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 51588b6..aa95c76 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,7 +2,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -27,9 +53,11 @@ - + - + + + @@ -37,7 +65,7 @@ - + @@ -54,34 +82,21 @@ - - + + - - + + - - - - - - - - - - - - - - + - - + + @@ -100,9 +115,12 @@ - + - + + + + @@ -110,22 +128,10 @@ - + - - - - - - - - - - - - - + @@ -134,7 +140,7 @@ - + @@ -167,7 +173,6 @@ @@ -221,6 +227,7 @@ + @@ -323,13 +330,12 @@ - - + @@ -427,18 +433,19 @@ + - - + - + @@ -502,7 +509,9 @@ - + + + @@ -510,10 +519,7 @@ - - - - + @@ -529,7 +535,10 @@ - + + + + @@ -554,19 +563,7 @@ - - - - - - - - - - - - - + @@ -598,7 +595,9 @@ - + + + @@ -606,10 +605,7 @@ - - - - + @@ -625,7 +621,10 @@ - + + + + @@ -650,19 +649,7 @@ - - - - - - - - - - - - - + @@ -694,7 +681,9 @@ - + + + @@ -702,7 +691,10 @@ - + + + + @@ -725,7 +717,9 @@ - + + + @@ -799,7 +793,7 @@ - + @@ -807,9 +801,12 @@ - + - + + + + @@ -821,55 +818,49 @@ - - - - - - - - - - - - + - - - - - - - - - - - - - + - + - + + + - + + + + + + + + + + + + + + + + @@ -878,14 +869,6 @@ - - - - - - - - @@ -894,10 +877,10 @@ - + - - + + diff --git a/app/App.php b/app/App.php index 0a26a12..1d3f8c2 100644 --- a/app/App.php +++ b/app/App.php @@ -108,20 +108,19 @@ class App extends Application $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) { + public function registerExtenders() + { + if (!$this['debug']) { + $this->error(function (\Exception $e, \Symfony\Component\HttpFoundation\Request $request, $code) { switch ($code) { case 405: - preg_match('/\(Allow\:(.+)\)/', $e->getMessage(), $matches); - if(isset($matches[1])) { - $matches = trim($matches[1]); - } elseif(isset($matches[0])) { - $matches = trim($matches[0]); + if (isset($matches[1])) { + $matches = trim($matches[1]); + } elseif (isset($matches[0])) { + $matches = trim($matches[0]); } else { - $matches = 'Available methods are unknown.'; + $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(); @@ -131,10 +130,10 @@ class App extends Application } return new \Symfony\Component\HttpFoundation\Response($message, $code); }); - } - $this->extend('twig', function (\Twig_Environment $twig) { + } + $this->extend('twig', function (\Twig_Environment $twig) { if ($this['debug']) { - $twig->enableDebug(); + $twig->enableDebug(); } $twig->addExtension(new Twig_Extensions_Extension_Date()); $twig->addExtension(new Sikofitt\Twig\Date()); @@ -142,10 +141,10 @@ class App extends Application $twig->addGlobal('config', $this->config('all')); return $twig; }); - } + } public function boot() { - $this->registerExtenders(); + $this->registerExtenders(); // register default icons $this->registerDefaultIcons(); return parent::boot(); diff --git a/app/views/resume.html.twig b/app/views/resume.html.twig index bc14edd..826317d 100644 --- a/app/views/resume.html.twig +++ b/app/views/resume.html.twig @@ -1,236 +1,251 @@ {% extends app.config.twig.template %} {% block title %} - {{ app.config.app.title | default('Resume') }} + {{ app.config.app.title | default('Resume') }} {% endblock %} {% block body %} -
-
-

- {% if basics.name is not empty %} - {{ basics.name }} +
+
+

+ {% if basics.name is not empty %} + {{ basics.name }} + {% else %} + {{ app.config.app.title|default('Resume') }} + {% endif %} + {% if basics.label is not empty %} + {{ basics.label }} + {% endif %} +

+
+ {% if basics.summary is not empty %} +

{{ basics.summary }}

+ {% endif %} + +
+
+ +
+
+

Experience

+
+ +
+ {% for position in work %} +

+ {{ position.company }} + + {{ position.startDate|date('Y') }} - + {% if position.endDate is not defined %} + Current {% else %} - {{ app.config.app.title|default('Resume') }} + {{ position.endDate|date('Y') }} {% endif %} - {% if basics.label is not empty %} - {{ basics.label }} + + (~ + {% if position.endDate is not defined %} + {{ position.startDate|date_diff }} + {% else %} + {{ position.startDate|date_diff(position.endDate) }} {% endif %} -

-
- {% if basics.summary is not empty %} -

{{ basics.summary }}

+ ) +
+

+
{{ position.position }}
+

+ {{ position.summary|raw }} +

+ + + {% if position.highlights is not empty and position.highlights is defined %} +
+
Highlights
+ {% for highlight in position.highlights %} +
{{ highlight|raw }} {# raw is deprecated in 2.0 #}
+ {% endfor %} +
{% endif %} +
+ {% endfor %}
+
+ -
-
-

Experience

-
+
-
- {% for position in work %} -

- {{ position.company }} - - {{ position.startDate|date('Y') }} - - {% if position.endDate is not defined %} - Current - {% else %} - {{ position.endDate|date('Y') }} - {% endif %} - - (~ - {% if position.endDate is not defined %} - {{ position.startDate|date_diff }} - {% else %} - {{ position.startDate|date_diff(position.endDate) }} - {% endif %} - ) - -

-
{{ position.position }}
-

- {{ position.summary|raw }} -

+
- {% if position.highlights is not empty and position.highlights is defined %} -
-
Highlights
- {% for highlight in position.highlights %} -
{{ highlight|raw }} {# raw is deprecated in 2.0 #}
- {% endfor %} -
- {% endif %} -
- {% endfor %} - -
-
- +
+
+

Contact

-
- -
- - -
- -
-

Contact

- -
    - - {% if app.config.app.email is not empty %} - -
  • [Hidden information]
  • - {% endif %} - {% if basics.website is not empty %} -
  • {{ basics.website }}
  • - {% endif %} - {% if basics.location|length > 0 and basics.location is not empty %} -
  • -
    - {% set location = basics.location %} - - {% if location.address is not empty %} - {{ location.address }}
    - {% endif %} - {% if location.city is not empty %} - {{ location.city }}, - {% endif %} - {% if location.region is not empty %} -  {{ location.region }}, - {% endif %} - {% if location.countryCode is not empty %} -  {{ location.countryCode }} - {% endif %}
    - -
    -
  • - {% endif %} -
  • - {% for profile in basics.profiles %} - {{ render_profile(profile)|raw }} - {% endfor %} - -
  • -
  • -
- {% if skills is defined and skills is not empty %} - -

Skills

- -
- {% for skill in skills %} -
{{ skill.name }}
-
{{ skill.keywords|join(', ')|raw }}
- {% endfor %} -
- - {% endif %} - - -
- - -
- -
-
-
- - -
- -
-

Verify

-
-

Verify that you are a human please.

-
-
-
-
-
- -
-
- -
-
-
-
-
-
-
    - {% if basics.email is not empty %} -
  • {{ basics.email }}
  • - {% endif %} - {% if basics.phone is not empty %} -
  • {{ basics.phone }}
  • - {% endif %} - {% if basics.location|length > 0 and basics.location is not empty %} -
  • -
    - {% for location in basics.location %} - {% if location.address is not empty %} - {{ location.address }}
    - {% endif %} - {% if location.city is not empty %} - {{ location.city }} - {% if location.postalCode is not empty %} -  {{ location.postalCode }} - {% endif %} - {% if location.countryCode is not empty %} -  {{ location.countryCode }} - {% endif %}
    - {% endif %} - {% endfor %} -
    -
  • - {% endif %} -
  • + {% if app.config.app.phone is not empty %} + +
  • Phone
  • + {% endif %} + {% if basics.email is not empty %} +
  • {{ basics.email }}
  • + {% endif %} + {% if basics.website is not empty %} +
  • {{ basics.website }}
  • + {% endif %} + {% if basics.location|length > 0 and basics.location is not empty %} +
  • +
    + {% set location = basics.location %} + + {% if location.address is not empty %} + {{ location.address }}
    + {% endif %} + {% if location.city is not empty %} + {{ location.city }}, + {% endif %} + {% if location.region is not empty %} +  {{ location.region }}, + {% endif %} + {% if location.countryCode is not empty %} +  {{ location.countryCode }} + {% endif %}
    + +
  • + {% endif %} +
  • + {% for profile in basics.profiles %} + {{ render_profile(profile)|raw }} + {% endfor %} + +
  • +
+ {% if skills is defined and skills is not empty %} + +

Skills

+ +
+ {% for skill in skills %} +
{{ skill.name }}
+
{{ skill.keywords|join(', ')|raw }}
+ {% endfor %} +
+ + {% endif %} + + +
+ +
+ +
+
+
+ + +
+ +
+

Verify

+
+

Verify that you are a human please.

+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+
    + {% if basics.email is not empty %} +
  • {{ basics.email }}
  • + {% endif %} + {% if basics.phone is not empty %} +
  • {{ basics.phone }}
  • + {% endif %} + {% if basics.location|length > 0 and basics.location is not empty %} +
  • +
    + {% for location in basics.location %} + {% if location.address is not empty %} + {{ location.address }}
    + {% endif %} + {% if location.city is not empty %} + {{ location.city }} + {% if location.postalCode is not empty %} +  {{ location.postalCode }} + {% endif %} + {% if location.countryCode is not empty %} +  {{ location.countryCode }} + {% endif %}
    + {% endif %} + {% endfor %} +
    +
  • + {% endif %} +
  • + +
  • +
+
+
{% endblock %} {% block javascripts_foot %} - + {% endblock %} {% block inline_js_foot %} - + }); + }); + {% endblock %} \ No newline at end of file diff --git a/package.json b/package.json index 18211ad..f4d61f2 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "grunt-contrib-clean": "^1.0.0", "grunt-contrib-copy": "^1.0.0", "grunt-contrib-less": "^1.3.0", + "grunt-contrib-uglify": "^1.0.1", "grunt-contrib-watch": "^1.0.0", "grunt-phpunit": "^0.3.6", "less-plugin-autoprefix": "^1.5.1", @@ -16,5 +17,4 @@ "scripts": { "postinstall": "npm install -g grunt; npm install -g bower; .heroku/node/bin/bower install; .heroku/node/bin/grunt; .heroku/node/bin/grunt copy" } - } diff --git a/src/Sikofitt/Controller/ApiControllerProvider.php b/src/Sikofitt/Controller/ApiControllerProvider.php index 55e2efa..aa5a693 100644 --- a/src/Sikofitt/Controller/ApiControllerProvider.php +++ b/src/Sikofitt/Controller/ApiControllerProvider.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. * @@ -15,29 +25,31 @@ namespace Sikofitt\Controller; use ReCaptcha\ReCaptcha; -use Silex\Application; use Silex\Api\ControllerProviderInterface; +use Silex\Application; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; -class ApiControllerProvider implements ControllerProviderInterface { +class ApiControllerProvider implements ControllerProviderInterface +{ - public function connect(Application $app) { - $controllers = $app['controllers_factory']; + public function connect(Application $app) + { + $controllers = $app['controllers_factory']; - $controllers->get('/v1/schema', function() { + $controllers->get('/v1/schema', function () { return new \Symfony\Component\HttpFoundation\Response('Success!'); }); - $controllers->post('/v1/captcha', function(Request $request) use ($app) { + $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 = [ + 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.', @@ -45,24 +57,22 @@ class ApiControllerProvider implements ControllerProviderInterface { ], ]; } else { - - $errorCodes = [ + $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]; + foreach ($valid->getErrorCodes() as $code) { + if (array_key_exists($code, $errorCodes)) { + $errors[] = $errorCodes[$code]; + } } - } - if(!isset($errors)) { - $errors[] = 'An unknown error occurred.'; - } - $return = [ + if (!isset($errors)) { + $errors[] = 'An unknown error occurred.'; + } + $return = [ 'valid' => false, 'message' => $errors, ]; @@ -71,6 +81,6 @@ class ApiControllerProvider implements ControllerProviderInterface { return new JsonResponse(json_encode($return)); }); - return $controllers; - } -} \ No newline at end of file + return $controllers; + } +}