Skip to content

Commit

Permalink
Bug #1, fix to travis YAML file; PHP fixes via CodeClimate
Browse files Browse the repository at this point in the history
  • Loading branch information
nfreear committed Feb 25, 2016
1 parent 0424256 commit 1bc8a48
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 12 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ vendor/*
test/node_modules/*

*BAK*
.DS_Store


#End.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ install:
- composer install
- composer install-npm

before_script:
- cp app.TEMPLATE.yaml app.yaml

script:
- composer test

Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

[![Build status – Travis-CI][travis-icon]][travis]

# AccessifyWiki-API

Portable/ Google App Engine hosted PHP-based API for AccessifyWiki accessibility fixes.
Expand Down Expand Up @@ -40,5 +42,8 @@ composer deploy
[@nfreear/wp-accessify]: https://github.com/nfreear/wp-accessify "WordPress plugin"
[@nfreear/accessify-client-php]: https://github.com/nfreear/accessify-client-php "PHP client library"

[travis]: https://travis-ci.org/accessifywiki/accessifywiki-api
[travis-icon]: https://travis-ci.org/accessifywiki/accessifywiki-api.svg "Build status – Travis-CI"


[End]: //end.
4 changes: 1 addition & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@
"jakub-onderka/php-parallel-lint": "^0.9.2"
},
"suggest": {
"slim/slim": "^2.6",
"slim/slim::3": "^3.0; Requires PHP >=5.5 :(",
"silex/silex": "^1.3",
"devster/frontmatter": "^1.0@dev",
"kzykhys/yaml-front-matter": "^1.0"
"devster/frontmatter": "^1.0@dev"
},
"autoload": {
"psr-4": {
Expand Down
7 changes: 3 additions & 4 deletions src/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,11 @@ private static function setErrorHandler()
}


public function jsonOLD($obj, $response = null) //OLD.
public function jsonOLD($obj, Response $response = null) //OLD.
{
$response = $response ? $response : $this->response; //???
$callback = $this->getParam('callback');
$callback = preg_match('/^[a-z_][\w\._]+$/', $callback) ? $callback : null;
$callback = $this->getValidCallback();

$response = $response->withHeader('Access-Control-Allow-Origin', '*');
$response = $response->withHeader('Content-Type', 'application/json; charset=utf-8');
Expand All @@ -77,7 +76,7 @@ private function getValidCallback()
return $callback && preg_match(self::CALLBACK_REGEX, $callback) ? $callback : null;
}

public function getRequiredUrl(&$response)
public function getRequiredUrl(Response &$response)
{
$url = $this->getParam('url', FILTER_VALIDATE_URL);
if (! $url) {
Expand Down
4 changes: 2 additions & 2 deletions src/DotEnvMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class DotEnvMiddleware
*
* @return \Psr\Http\Message\ResponseInterface
*/
public function __invoke($request, $response, $next)
public function __invoke(Request $request, Response $response, $next)
{
try {
if (self::envIsTrue('aw_use_dotenv')) {
Expand All @@ -35,7 +35,7 @@ public function __invoke($request, $response, $next)
} else {
$this->testGoogeAppEngineVariables();
}
} catch (Exception $ex) {
} catch (\Exception $ex) {
header('HTTP/1.1 500');
header('X-AW-Debug-00', 'dotenv = fail' . $ex->getMessage());
echo 'Dotenv error! '. $ex->getMessage();
Expand Down
1 change: 0 additions & 1 deletion src/GitHub.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
*/

use \GuzzleHttp\Client;
use \Symfony\Component\Yaml\Yaml;

class GitHub
{
Expand Down
1 change: 0 additions & 1 deletion test/validate-app-yaml.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,5 @@
}

fprintf(STDERR, "OK. YAML file parsed: '%s' - %s\n", $e->getMessage(), $yaml_file);
exit(0);

#End.

0 comments on commit 1bc8a48

Please sign in to comment.