diff --git a/.gitignore b/.gitignore index a866481..57fca2b 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,5 @@ coverage sonar-project.properties vendor composer.lock +.scannerwork/ +phpunit.*.xml diff --git a/.scrutinizer.yml b/.scrutinizer.yml new file mode 100644 index 0000000..6202a98 --- /dev/null +++ b/.scrutinizer.yml @@ -0,0 +1,4 @@ +build: + environment: + php: + version: '7.4' diff --git a/.styleci.yml b/.styleci.yml new file mode 100644 index 0000000..8e1a38f --- /dev/null +++ b/.styleci.yml @@ -0,0 +1,7 @@ +risky: false +version: 7 +preset: psr12 +finder: + exclude: + - "vendor" + name: "*.php" diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..cd2f759 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,24 @@ +language: php +sudo: false + +php: + - 7.4 + +cache: + directories: + - $HOME/.composer/cache + +addons: + sonarcloud: + organization: "verbanent-public" + token: + secure: "flumy3jpJ+Je/oYe+CglzMCEMJurdOvPOxAkBm6q60vPxgpMTsF9bHuGxxBEuBGleCwqJGArbmctmslPzwpcAkyB39Yy3YuOowwqeT3wmi8Phl7/2vPLKnAlY6Npc6OLi43b8zaufuhUl5hfS2feVxlSaZtbXEvCuajmsZNpDId/nIEPkzH7Wv1tYHAStWUOav8wumB+ej/IRzQFsjvJoKFnGlJm9tsBf+5vq9RXTgcwV88DHOGdgWTyUVU8SUmH99VQ7m4kfiuyQohrjnj5E+CKsOnDY0DGrgchzJnqK2h5xaexgdPGCPLdWu23MS+iamJMA6knVmFcUjzzhFwcVo33EY1ZMHWk4I0sI8xHrENOmfJ83+7AC2fDwJseLqUD18h4HMd5lnFyVdXbJrFOzVmdrAWTUenDXJx6ZMlIfBOFoBOt3k+DfI7UgtW6+KLL+b0d7LjQNdpkwmieYGKbsGm0QsKeytPUpPg8OrpieJZ4LADu69cuHcpB5ZifijKx8mM3CONxi2YYJ/Rro9t9W5Shk1N9ww60uRHlHpyeDFZEtFTXHTFnVhcmPfuaWdoJjPLo8iNNI2FD4YSUOYXHNfr1r165znwF+3KbVFaaxciZfWyordZUSgknFMomRFOM3H5bVnncsgsnZ+HYBon/NUgbK2Z9fWN++jfgLAQekrk=" + +git: + depth: false + +install: composer update --no-interaction --no-suggest --no-progress + +script: + - phpdbg -qrr vendor/bin/phpunit --coverage-clover phpunit.coverage.xml --log-junit phpunit.report.xml + diff --git a/LICENSE b/LICENSE index 7171bff..83d112d 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2019 Verbanent +Copyright (c) 2020 Radek Ziemniewicz Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 830fffe..7c37d40 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,14 @@ # Ordered binary UUID in Laravel / Eloquent [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=verbanent_eloquent-binary-uuid&metric=alert_status)](https://sonarcloud.io/dashboard?id=verbanent_eloquent-binary-uuid) -[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=verbanent_eloquent-binary-uuid&metric=coverage)](https://sonarcloud.io/dashboard?id=verbanent_eloquent-binary-uuid) -[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=verbanent_eloquent-binary-uuid&metric=sqale_rating)](https://sonarcloud.io/dashboard?id=verbanent_eloquent-binary-uuid) -[![StyleCI](https://github.styleci.io/repos/285826449/shield?branch=master)](https://github.styleci.io/repos/285826449) [![Downloads](https://img.shields.io/packagist/dt/verbanent/eloquent-binary-uuid.svg)](https://packagist.org/packages/verbanent/eloquent-binary-uuid) +[![StyleCI](https://github.styleci.io/repos/285826449/shield?branch=master)](https://github.styleci.io/repos/285826449) [![CodeFactor](https://www.codefactor.io/repository/github/verbanent/eloquent-binary-uuid/badge)](https://www.codefactor.io/repository/github/verbanent/eloquent-binary-uuid) +[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=verbanent_eloquent-binary-uuid&metric=sqale_rating)](https://sonarcloud.io/dashboard?id=verbanent_eloquent-binary-uuid) +[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=verbanent_eloquent-binary-uuid&metric=ncloc)](https://sonarcloud.io/dashboard?id=verbanent_eloquent-binary-uuid) +[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=verbanent_eloquent-binary-uuid&metric=coverage)](https://sonarcloud.io/dashboard?id=verbanent_eloquent-binary-uuid) +![Packagist PHP Version Support](https://img.shields.io/packagist/php-v/verbanent/eloquent-binary-uuid) +![Packagist License](https://img.shields.io/packagist/l/verbanent/eloquent-binary-uuid) Based on articles about the optimization of UUID storage in databases, I decided to write a simple library that allows this in my projects. I based on the information available here: https://www.percona.com/blog/2014/12/19/store-uuid-optimized-way/ diff --git a/composer.json b/composer.json index fc869aa..23f89c1 100644 --- a/composer.json +++ b/composer.json @@ -2,9 +2,7 @@ "authors": [ { "name": "Radek Ziemniewicz", - "email": "radoslaw@ziemniewicz.pl", - "homepage": "https://ziemniewicz.eu", - "role": "Developer" + "email": "open-source@quillstack.com" } ], "autoload": { @@ -33,7 +31,7 @@ "ordered", "uuid" ], - "license": "LGPL-3.0-or-later", + "license": "MIT", "name": "verbanent/eloquent-binary-uuid", "description": "Ordered binary UUID in Laravel / Eloquent based on UUID version 1", "require": { diff --git a/phpunit.xml b/phpunit.xml index dc1c052..66c323f 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,29 +1,16 @@ - - - - - - tests - - - - - - src/ - - - - - - - - \ No newline at end of file + + + + src/ + + + + + tests + + + + + + diff --git a/tests/Grammars/MySqlGrammarTest.php b/tests/Grammars/MySqlGrammarTest.php index bcc581a..75602dd 100644 --- a/tests/Grammars/MySqlGrammarTest.php +++ b/tests/Grammars/MySqlGrammarTest.php @@ -5,6 +5,8 @@ namespace Verbanent\Uuid\Test\Grammars; use PHPUnit\Framework\TestCase; +use ReflectionException; +use ReflectionMethod; use Verbanent\Uuid\Grammars\MySqlGrammar; /** @@ -17,11 +19,10 @@ class MySqlGrammarTest extends TestCase * * @param string $name * - * @throws \ReflectionException - * - * @return \ReflectionMethod + * @return ReflectionMethod + * @throws ReflectionException */ - protected static function getMethod(string $name): \ReflectionMethod + protected static function getMethod(string $name): ReflectionMethod { $class = new \ReflectionClass(MySqlGrammar::class); $method = $class->getMethod($name); @@ -33,7 +34,7 @@ protected static function getMethod(string $name): \ReflectionMethod /** * Test for MySqlGrammar::typeUuid. * - * @throws \ReflectionException + * @throws ReflectionException */ public function testTypeUuid(): void { @@ -41,7 +42,7 @@ public function testTypeUuid(): void $typeUuid = self::getMethod('typeUuid'); $uuidMySqlType = $typeUuid->invokeArgs($mySqlGrammar, [new \Illuminate\Support\Fluent()]); - $this->assertIsString($uuidMySqlType, 'Got '.gettype($uuidMySqlType).' instead of string'); - $this->assertEquals('binary(16)', $uuidMySqlType, 'Got '.$uuidMySqlType.' instead of \'binary(16)\''); + $this->assertIsString($uuidMySqlType, 'Got ' . gettype($uuidMySqlType) . ' instead of string'); + $this->assertEquals('binary(16)', $uuidMySqlType, 'Got ' . $uuidMySqlType . ' instead of \'binary(16)\''); } }