@@ -15,8 +15,7 @@ |
||
| 15 | 15 | * Class Version |
| 16 | 16 | * @package App\Claims |
| 17 | 17 | */ |
| 18 | -class Version extends Claim |
|
| 19 | -{ |
|
| 18 | +class Version extends Claim { |
|
| 20 | 19 | //<editor-fold desc="Fields"> |
| 21 | 20 | /** |
| 22 | 21 | * {@inheritdoc} |
@@ -17,8 +17,7 @@ discard block |
||
| 17 | 17 | * Class Logging |
| 18 | 18 | * @package Tfboe\FmLib\Helpers |
| 19 | 19 | */ |
| 20 | -abstract class Logging |
|
| 21 | -{ |
|
| 20 | +abstract class Logging { |
|
| 22 | 21 | //<editor-fold desc="Fields"> |
| 23 | 22 | /** @var bool */ |
| 24 | 23 | public static $testing = false; |
@@ -36,8 +35,7 @@ discard block |
||
| 36 | 35 | * @param int $type the type of the message |
| 37 | 36 | * @throws \Tfboe\FmLib\Exceptions\ValueNotValid invalid logger |
| 38 | 37 | */ |
| 39 | - public static function log(string $message, string $logger = Logs::GENERAL, int $type = Logger::INFO) |
|
| 40 | - { |
|
| 38 | + public static function log(string $message, string $logger = Logs::GENERAL, int $type = Logger::INFO) { |
|
| 41 | 39 | if (self::$testing && $logger !== Logs::TESTING) { |
| 42 | 40 | //do nothing |
| 43 | 41 | return; |
@@ -13,8 +13,7 @@ |
||
| 13 | 13 | * Class Logs |
| 14 | 14 | * @package Tfboe\FmLib\Helpers |
| 15 | 15 | */ |
| 16 | -abstract class Logs extends BasicEnum |
|
| 17 | -{ |
|
| 16 | +abstract class Logs extends BasicEnum { |
|
| 18 | 17 | //<editor-fold desc="Fields"> |
| 19 | 18 | const GENERAL = "general"; |
| 20 | 19 | const TESTING = "testing"; |
@@ -14,8 +14,7 @@ |
||
| 14 | 14 | * Class Level |
| 15 | 15 | * @package Tfboe\FmLib\Helpers |
| 16 | 16 | */ |
| 17 | -abstract class Level extends BasicEnum |
|
| 18 | -{ |
|
| 17 | +abstract class Level extends BasicEnum { |
|
| 19 | 18 | //<editor-fold desc="Fields"> |
| 20 | 19 | const COMPETITION = 3; |
| 21 | 20 | const GAME = 0; |
@@ -15,8 +15,7 @@ discard block |
||
| 15 | 15 | * Class BasicEnum |
| 16 | 16 | * @package Tfboe\FmLib\Entity\Categories |
| 17 | 17 | */ |
| 18 | -abstract class BasicEnum |
|
| 19 | -{ |
|
| 18 | +abstract class BasicEnum { |
|
| 20 | 19 | //<editor-fold desc="Fields"> |
| 21 | 20 | /** @var null|mixed[][] */ |
| 22 | 21 | private static $constCacheArray = NULL; |
@@ -55,8 +54,7 @@ discard block |
||
| 55 | 54 | * @return mixed the corresponding value |
| 56 | 55 | * @throws ValueNotValid if the name is not valid |
| 57 | 56 | */ |
| 58 | - public static function getValue(string $name, bool $strict = false) |
|
| 59 | - { |
|
| 57 | + public static function getValue(string $name, bool $strict = false) { |
|
| 60 | 58 | $constants = self::getConstants(); |
| 61 | 59 | if ($strict) { |
| 62 | 60 | if (array_key_exists($name, $constants)) { |
@@ -34,16 +34,14 @@ discard block |
||
| 34 | 34 | * Class FmLibServiceProvider |
| 35 | 35 | * @package Tfboe\FmLib\Providers |
| 36 | 36 | */ |
| 37 | -class FmLibServiceProvider extends ServiceProvider |
|
| 38 | -{ |
|
| 37 | +class FmLibServiceProvider extends ServiceProvider { |
|
| 39 | 38 | //<editor-fold desc="Public Methods"> |
| 40 | 39 | /** |
| 41 | 40 | * Bootstrap the application services. |
| 42 | 41 | * |
| 43 | 42 | * @return void |
| 44 | 43 | */ |
| 45 | - public function boot() |
|
| 46 | - { |
|
| 44 | + public function boot() { |
|
| 47 | 45 | include __DIR__ . '/../routes.php'; |
| 48 | 46 | } |
| 49 | 47 | |
@@ -53,8 +51,7 @@ discard block |
||
| 53 | 51 | * |
| 54 | 52 | * @return void |
| 55 | 53 | */ |
| 56 | - public function register() |
|
| 57 | - { |
|
| 54 | + public function register() { |
|
| 58 | 55 | //register middleware |
| 59 | 56 | app()->routeMiddleware(['auth' => Authenticate::class]); |
| 60 | 57 | |
@@ -13,8 +13,7 @@ discard block |
||
| 13 | 13 | * Class TestCase |
| 14 | 14 | * @package Tests\Helpers |
| 15 | 15 | */ |
| 16 | -abstract class LumenTestCase extends TestCase |
|
| 17 | -{ |
|
| 16 | +abstract class LumenTestCase extends TestCase { |
|
| 18 | 17 | use ReflectionMethods; |
| 19 | 18 | use OnlyTestLogging; |
| 20 | 19 | |
@@ -28,8 +27,7 @@ discard block |
||
| 28 | 27 | * @param mixed[] $enumProperties the enum properties to check, property name maps to an info array, which contains |
| 29 | 28 | * the enum name and the default value |
| 30 | 29 | */ |
| 31 | - protected function checkProperties(array $data, $object, array $properties, array $enumProperties = []) |
|
| 32 | - { |
|
| 30 | + protected function checkProperties(array $data, $object, array $properties, array $enumProperties = []) { |
|
| 33 | 31 | foreach ($properties as $property => $default) { |
| 34 | 32 | $getter = 'get' . ucfirst($property); |
| 35 | 33 | if (!method_exists($object, $getter)) { |
@@ -19,8 +19,7 @@ discard block |
||
| 19 | 19 | * Class AuthenticatedTestCase |
| 20 | 20 | * @package Tests\Helpers |
| 21 | 21 | */ |
| 22 | -abstract class AuthenticatedTestCase extends DatabaseTestCase |
|
| 23 | -{ |
|
| 22 | +abstract class AuthenticatedTestCase extends DatabaseTestCase { |
|
| 24 | 23 | //<editor-fold desc="Fields"> |
| 25 | 24 | /** |
| 26 | 25 | * Authentication token if logged in |
@@ -44,20 +43,17 @@ discard block |
||
| 44 | 43 | * @param array $headers the request headers |
| 45 | 44 | * @return $this |
| 46 | 45 | */ |
| 47 | - protected function jsonAuth(string $method, string $uri, array $data = [], array $headers = []) |
|
| 48 | - { |
|
| 46 | + protected function jsonAuth(string $method, string $uri, array $data = [], array $headers = []) { |
|
| 49 | 47 | $headers['Authorization'] = 'Bearer ' . $this->token; |
| 50 | 48 | return $this->json($method, $uri, $data, $headers); |
| 51 | 49 | } |
| 52 | 50 | |
| 53 | - protected function workOnDatabaseDestroy() |
|
| 54 | - { |
|
| 51 | + protected function workOnDatabaseDestroy() { |
|
| 55 | 52 | $this->clearUsers(); |
| 56 | 53 | parent::workOnDatabaseDestroy(); |
| 57 | 54 | } |
| 58 | 55 | |
| 59 | - protected function workOnDatabaseSetUp() |
|
| 60 | - { |
|
| 56 | + protected function workOnDatabaseSetUp() { |
|
| 61 | 57 | $this->clearUsers(); |
| 62 | 58 | parent::workOnDatabaseSetUp(); |
| 63 | 59 | $password = $this->newPassword(); |
@@ -71,8 +67,7 @@ discard block |
||
| 71 | 67 | //</editor-fold desc="Protected Methods"> |
| 72 | 68 | |
| 73 | 69 | //<editor-fold desc="Private Methods"> |
| 74 | - private function clearUsers() |
|
| 75 | - { |
|
| 70 | + private function clearUsers() { |
|
| 76 | 71 | /** @var Connection $connection */ |
| 77 | 72 | /** @noinspection PhpUndefinedMethodInspection */ |
| 78 | 73 | $connection = EntityManager::getConnection(); |
@@ -17,8 +17,7 @@ discard block |
||
| 17 | 17 | * Class DatabaseTestCase |
| 18 | 18 | * @package Tests\Helpers |
| 19 | 19 | */ |
| 20 | -abstract class DatabaseTestCase extends LumenTestCase |
|
| 21 | -{ |
|
| 20 | +abstract class DatabaseTestCase extends LumenTestCase { |
|
| 22 | 21 | //<editor-fold desc="Fields"> |
| 23 | 22 | /** |
| 24 | 23 | * @var \Faker\Generator |
@@ -39,8 +38,7 @@ discard block |
||
| 39 | 38 | * @param string $dataName test data name |
| 40 | 39 | * @param bool $clear |
| 41 | 40 | */ |
| 42 | - public function __construct($name = null, array $data = [], $dataName = '', $clear = false) |
|
| 43 | - { |
|
| 41 | + public function __construct($name = null, array $data = [], $dataName = '', $clear = false) { |
|
| 44 | 42 | parent::__construct($name, $data, $dataName); |
| 45 | 43 | srand(3); //always use the same faker values to get reproducibility |
| 46 | 44 | $this->faker = Factory::create(); |
@@ -54,8 +52,7 @@ discard block |
||
| 54 | 52 | * Clears the database by truncating all tables (very time consuming) |
| 55 | 53 | * @throws \Doctrine\DBAL\DBALException |
| 56 | 54 | */ |
| 57 | - protected function clearDatabase() |
|
| 58 | - { |
|
| 55 | + protected function clearDatabase() { |
|
| 59 | 56 | /** @var \Doctrine\DBAL\Connection $connection */ |
| 60 | 57 | /** @noinspection PhpUndefinedMethodInspection */ |
| 61 | 58 | $connection = EntityManager::getConnection(); |
@@ -106,8 +103,7 @@ discard block |
||
| 106 | 103 | * Creates a new user |
| 107 | 104 | * @return array containing the password and the user object |
| 108 | 105 | */ |
| 109 | - protected function createUser() |
|
| 110 | - { |
|
| 106 | + protected function createUser() { |
|
| 111 | 107 | $password = $this->newPassword(); |
| 112 | 108 | /** @var User $user */ |
| 113 | 109 | $user = entity(User::class)->create(['originalPassword' => $password]); |
@@ -121,8 +117,7 @@ discard block |
||
| 121 | 117 | * Uses faker to generate a new password |
| 122 | 118 | * @return string the new password |
| 123 | 119 | */ |
| 124 | - protected function newPassword() |
|
| 125 | - { |
|
| 120 | + protected function newPassword() { |
|
| 126 | 121 | return $this->faker->password(8, 30); |
| 127 | 122 | } |
| 128 | 123 | |
@@ -132,8 +127,7 @@ discard block |
||
| 132 | 127 | * @return void |
| 133 | 128 | * @throws \Doctrine\DBAL\DBALException |
| 134 | 129 | */ |
| 135 | - protected function setUpTraits() |
|
| 136 | - { |
|
| 130 | + protected function setUpTraits() { |
|
| 137 | 131 | srand(3); //always use the same faker values to get reproducibility |
| 138 | 132 | $clear = $this->clear; |
| 139 | 133 | parent::setUpTraits(); |
@@ -158,13 +152,11 @@ discard block |
||
| 158 | 152 | }); |
| 159 | 153 | } |
| 160 | 154 | |
| 161 | - protected function workOnDatabaseDestroy() |
|
| 162 | - { |
|
| 155 | + protected function workOnDatabaseDestroy() { |
|
| 163 | 156 | |
| 164 | 157 | } |
| 165 | 158 | |
| 166 | - protected function workOnDatabaseSetUp() |
|
| 167 | - { |
|
| 159 | + protected function workOnDatabaseSetUp() { |
|
| 168 | 160 | |
| 169 | 161 | } |
| 170 | 162 | //</editor-fold desc="Protected Methods"> |