From c191635755240d16d643f5c494c48d391f85cbea Mon Sep 17 00:00:00 2001 From: Darryn Ten Date: Sun, 12 Feb 2017 01:21:28 +0000 Subject: [PATCH] Apply fixes from StyleCI --- src/Config.php | 2 +- src/GoogleNaturalLanguage.php | 7 ++--- .../GoogleNaturalLanguagePhpExceptionTest.php | 7 ++--- .../GoogleNaturalLanguageTest.php | 26 ++++++++++--------- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/Config.php b/src/Config.php index 03dfac2..5067abd 100644 --- a/src/Config.php +++ b/src/Config.php @@ -146,7 +146,7 @@ public function __construct($config) /** * TODO - + if (isset($config['authCache']) && !empty($config['authCache'])) { $this->authCache = (bool)$config['cache']; } diff --git a/src/GoogleNaturalLanguage.php b/src/GoogleNaturalLanguage.php index 6b5e28e..c90781e 100644 --- a/src/GoogleNaturalLanguage.php +++ b/src/GoogleNaturalLanguage.php @@ -181,7 +181,7 @@ private function _checkCheapskate() * * @return void */ - public function setType($type) + public function setType($type) { if (Validation::isValidType($type)) { $this->config->type = $type; @@ -195,7 +195,7 @@ public function setType($type) * * @return void */ - public function setEncoding($encoding) + public function setEncoding($encoding) { if (Validation::isValidEncoding($encoding)) { $this->config->encoding = $encoding; @@ -240,6 +240,3 @@ public function setCache($value) $this->config->cache = (bool)$value; } } - - - diff --git a/tests/GoogleNaturalLanguagePhp/GoogleNaturalLanguagePhpExceptionTest.php b/tests/GoogleNaturalLanguagePhp/GoogleNaturalLanguagePhpExceptionTest.php index 72de00e..aeb6036 100644 --- a/tests/GoogleNaturalLanguagePhp/GoogleNaturalLanguagePhpExceptionTest.php +++ b/tests/GoogleNaturalLanguagePhp/GoogleNaturalLanguagePhpExceptionTest.php @@ -17,7 +17,8 @@ public function testApiException() ], 'xxx'); } - public function testApiJsonException() { + public function testApiJsonException() + { $this->expectException(CustomException::class); throw new CustomException(json_encode( @@ -32,7 +33,8 @@ public function testApiJsonException() { )); } - public function testCheapskateTriggerException() { + public function testCheapskateTriggerException() + { $this->expectException(CustomException::class); $config = [ @@ -45,4 +47,3 @@ public function testCheapskateTriggerException() { $instance->setText(str_repeat('test ', 1000)); } } - diff --git a/tests/GoogleNaturalLanguagePhp/GoogleNaturalLanguageTest.php b/tests/GoogleNaturalLanguagePhp/GoogleNaturalLanguageTest.php index f9ce789..761959e 100644 --- a/tests/GoogleNaturalLanguagePhp/GoogleNaturalLanguageTest.php +++ b/tests/GoogleNaturalLanguagePhp/GoogleNaturalLanguageTest.php @@ -7,7 +7,7 @@ use DarrynTen\GoogleNaturalLanguagePhp\GoogleNaturalLanguage; -class GoogleNaturalLanguagePhpTest extends PHPUnit_Framework_TestCase +class GoogleNaturalLanguageTest extends PHPUnit_Framework_TestCase { public function testConstruct() { @@ -19,7 +19,8 @@ public function testConstruct() $this->assertInstanceOf(GoogleNaturalLanguage::class, $instance); } - public function testSet() { + public function testSet() + { $config = [ 'projectId' => 'project-id', 'cheapskate' => true, @@ -59,7 +60,8 @@ public function testSet() { $instance->setCache(true); } - public function testGetEntities() { + public function testGetEntities() + { if (getenv('DO_LIVE_API_TESTS') == "true") { $config = [ 'projectId' => 'project-id', @@ -87,9 +89,10 @@ public function testGetEntities() { } } - public function testGetSyntax() { + public function testGetSyntax() + { if (getenv('DO_LIVE_API_TESTS') == "true") { - $config = [ + $config = [ 'projectId' => 'project-id', 'cheapskate' => true, 'cache' => true, @@ -117,9 +120,10 @@ public function testGetSyntax() { } } - public function testGetSentiment() { + public function testGetSentiment() + { if (getenv('DO_LIVE_API_TESTS') == "true") { - $config = [ + $config = [ 'projectId' => 'project-id', 'cheapskate' => true, 'cache' => true, @@ -140,9 +144,10 @@ public function testGetSentiment() { } } - public function testGetAll() { + public function testGetAll() + { if (getenv('DO_LIVE_API_TESTS') == "true") { - $config = [ + $config = [ 'projectId' => 'project-id', 'cheapskate' => true, 'cache' => true, @@ -171,9 +176,6 @@ public function testGetAll() { $this->assertInternalType('string', $language); $this->assertEquals('en', $language); - } } } - -