Permalink
Browse files

Merge pull request #120 from maxmind/andy/travis-runs-snyk

Andy/travis runs snyk
  • Loading branch information...
oschwald committed Sep 20, 2018
2 parents 0094a80 + 6dc4eb4 commit 97c2becf356fbd8fde9f6e14f893c146b3ef5a2d
View
@@ -17,13 +17,18 @@ matrix:
before_install:
- composer install --dev -n --prefer-source
- phpenv rehash
- "if [[ $TRAVIS_PHP_VERSION == '7.2' ]]; then sudo apt install -y nodejs; npm install -g snyk; fi"
install:
- "if [[ $TRAVIS_PHP_VERSION == '7.2' ]]; then snyk test --org=maxmind; fi"
script:
- mkdir -p build/logs
- if [[ $TRAVIS_PHP_VERSION = '7.2' ]]; then vendor/bin/php-cs-fixer fix --verbose --diff --dry-run --config=.php_cs; fi
- if [[ $TRAVIS_PHP_VERSION = '7.2' ]]; then vendor/bin/phpcs --standard=PSR2 src/; fi
- "if [[ $TRAVIS_PHP_VERSION = '7.2' ]]; then vendor/bin/php-cs-fixer fix --verbose --diff --dry-run --config=.php_cs; fi"
- "if [[ $TRAVIS_PHP_VERSION = '7.2' ]]; then vendor/bin/phpcs --standard=PSR2 src/; fi"
- vendor/bin/phpunit -c phpunit.xml.dist
after_script:
- php vendor/bin/coveralls
after_success:
- "if [[ $TRAVIS_BRANCH == 'master' && $TRAVIS_PULL_REQUEST == 'false' && $TRAVIS_PHP_VERSION == '7.2' ]]; then snyk monitor --org=maxmind --project-name=maxmind/GeoIP2-php; fi"
notifications:
email:
on_failure: always
@@ -33,3 +38,6 @@ notifications:
slack:
rooms:
secure: "OtowN1lGa5MAhn6gl87aB3kXXeOKLGIb4e9dBud/tPt/1sQDoZVj6m6VWtpsXh6iXL7lWetVbpmeZCydSRumgVMIy7+45uMQPvdoWBFCT+rq67yDb3gyvFknpjBuit0Q91lTDoGTUSgtqk+PSZX5LvDgT4b8WQFBb/dcB35hqis=\n"
env:
global:
secure: "Ptt+TYu7h430sdv9WjIlKS6kWdwQQYapv8OYuZZ2sUrcynuHkMw3OMp+p3Y86KAMCd2ZwlOyeLA1V2QrifkiC9i1KmEqiH6eZcrzdt+YgrBK6S1BRjbrhabPBs6iT3ey6NxU+hEgl/+pb2R1VlKi1B5Fw7rJ1S6/34VhvgEpwDc="
View
@@ -245,7 +245,7 @@ private function getRecord($class, $type, $ipAddress)
"The address $ipAddress is not in the database."
);
}
if (!is_array($record)) {
if (!\is_array($record)) {
// This can happen on corrupt databases. Generally,
// MaxMind\Db\Reader will throw a
// MaxMind\Db\Reader\InvalidDatabaseException, but occasionally
@@ -255,7 +255,7 @@ private function getRecord($class, $type, $ipAddress)
// exceptions go unnoticed.
throw new InvalidDatabaseException(
"Expected an array when looking up $ipAddress but received: "
. gettype($record)
. \gettype($record)
);
}
@@ -51,7 +51,7 @@ private function attributeToKey($attr)
private function validAttribute($attr)
{
return in_array($attr, $this->validAttributes, true);
return \in_array($attr, $this->validAttributes, true);
}
public function jsonSerialize()
@@ -74,7 +74,7 @@ public function __construct(
// This is for backwards compatibility. Do not remove except for a
// major version bump.
if (is_string($options)) {
if (\is_string($options)) {
$options = ['host' => $options];
}
@@ -111,7 +111,7 @@ private function userAgent()
* @throws \GeoIp2\Exception\HttpException if an unexpected HTTP error code or message was returned.
* This could indicate a problem with the connection between
* your server and the web service or that the web service
* returned an invalid document or 500 error code.
* returned an invalid document or 500 error code
* @throws \GeoIp2\Exception\GeoIp2Exception This serves as the parent
* class to the above exceptions. It will be thrown directly
* if a 200 status code is returned but the body is invalid.
@@ -173,7 +173,7 @@ public function country($ipAddress = 'me')
* @throws \GeoIp2\Exception\HttpException if an unexpected HTTP error code or message was returned.
* This could indicate a problem with the connection between
* your server and the web service or that the web service
* returned an invalid document or 500 error code.
* returned an invalid document or 500 error code
* @throws \GeoIp2\Exception\GeoIp2Exception This serves as the parent
* class to the above exceptions. It will be thrown directly
* if a 200 status code is returned but the body is invalid.
@@ -424,11 +424,11 @@ private function response(
if ($bad) {
$body = '{ invalid: }';
} elseif (is_array($body)) {
} elseif (\is_array($body)) {
$body = json_encode($body);
}
$headers['Content-Length'] = strlen($body);
$headers['Content-Length'] = \strlen($body);
return [$status, $headers, $body];
}

0 comments on commit 97c2bec

Please sign in to comment.