Completed
Branch master (0dfbed)
by Benedikt
07:50
created
src/Helpers/Logging.php 3 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -38,20 +38,20 @@
 block discarded – undo
38 38
    */
39 39
   public static function log(string $message, string $logger = Logs::GENERAL, int $type = Logger::INFO)
40 40
   {
41
-    if (self::$testing && $logger !== Logs::TESTING) {
42
-      //do nothing
43
-      return;
44
-    }
45
-    Logs::ensureValidValue($logger);
46
-    if (!array_key_exists($logger, self::$loggers)) {
47
-      self::$loggers[$logger] = new Logger($logger);
48
-      // InvalidArgumentException => stream is a string
49
-      // Exception => path is static and it is ensured that it is valid
50
-      /** @noinspection PhpUnhandledExceptionInspection */
51
-      self::$loggers[$logger]->pushHandler(
52
-        new StreamHandler((self::$storagePathFunction)() . '/logs/' . $logger . '.log'));
53
-    }
54
-    self::$loggers[$logger]->log($type, $message);
41
+	if (self::$testing && $logger !== Logs::TESTING) {
42
+	  //do nothing
43
+	  return;
44
+	}
45
+	Logs::ensureValidValue($logger);
46
+	if (!array_key_exists($logger, self::$loggers)) {
47
+	  self::$loggers[$logger] = new Logger($logger);
48
+	  // InvalidArgumentException => stream is a string
49
+	  // Exception => path is static and it is ensured that it is valid
50
+	  /** @noinspection PhpUnhandledExceptionInspection */
51
+	  self::$loggers[$logger]->pushHandler(
52
+		new StreamHandler((self::$storagePathFunction)() . '/logs/' . $logger . '.log'));
53
+	}
54
+	self::$loggers[$logger]->log($type, $message);
55 55
   }
56 56
 //</editor-fold desc="Public Methods">
57 57
 }
58 58
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 /**
4 4
  * Created by PhpStorm.
5 5
  * User: benedikt
@@ -36,20 +36,20 @@  discard block
 block discarded – undo
36 36
    * @param int $type the type of the message
37 37
    * @throws \Tfboe\FmLib\Exceptions\ValueNotValid invalid logger
38 38
    */
39
-  public static function log(string $message, string $logger = Logs::GENERAL, int $type = Logger::INFO)
39
+  public static function log( string $message, string $logger = Logs::GENERAL, int $type = Logger::INFO )
40 40
   {
41
-    if (self::$testing && $logger !== Logs::TESTING) {
41
+    if ( self::$testing && $logger !== Logs::TESTING ) {
42 42
       //do nothing
43 43
       return;
44 44
     }
45 45
     Logs::ensureValidValue($logger);
46
-    if (!array_key_exists($logger, self::$loggers)) {
46
+    if ( !array_key_exists($logger, self::$loggers) ) {
47 47
       self::$loggers[$logger] = new Logger($logger);
48 48
       // InvalidArgumentException => stream is a string
49 49
       // Exception => path is static and it is ensured that it is valid
50 50
       /** @noinspection PhpUnhandledExceptionInspection */
51 51
       self::$loggers[$logger]->pushHandler(
52
-        new StreamHandler((self::$storagePathFunction)() . '/logs/' . $logger . '.log'));
52
+        new StreamHandler((self::$storagePathFunction)().'/logs/'.$logger.'.log'));
53 53
     }
54 54
     self::$loggers[$logger]->log($type, $message);
55 55
   }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -17,8 +17,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/Helpers/Logs.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 /**
4 4
  * Created by PhpStorm.
5 5
  * User: benedikt
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,8 +13,7 @@
 block discarded – undo
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";
Please login to merge, or discard this patch.
src/Helpers/Level.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 /**
4 4
  * Created by PhpStorm.
5 5
  * User: benedikt
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,7 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/Helpers/BasicEnum.php 4 patches
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -34,9 +34,9 @@  discard block
 block discarded – undo
34 34
    */
35 35
   public static function ensureValidValue($value, bool $strict = true): void
36 36
   {
37
-    if (!self::isValidValue($value, $strict)) {
38
-      throw new ValueNotValid($value, get_called_class());
39
-    }
37
+	if (!self::isValidValue($value, $strict)) {
38
+	  throw new ValueNotValid($value, get_called_class());
39
+	}
40 40
   }
41 41
 
42 42
   /**
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
    */
46 46
   public static function getNames(): array
47 47
   {
48
-    return array_keys(self::getConstants());
48
+	return array_keys(self::getConstants());
49 49
   }
50 50
 
51 51
   /**
@@ -57,20 +57,20 @@  discard block
 block discarded – undo
57 57
    */
58 58
   public static function getValue(string $name, bool $strict = false)
59 59
   {
60
-    $constants = self::getConstants();
61
-    if ($strict) {
62
-      if (array_key_exists($name, $constants)) {
63
-        return $constants[$name];
64
-      }
65
-    } else {
66
-      $mapping = self::getCaseMapping();
67
-      $key = strtolower($name);
68
-      if (array_key_exists($key, $mapping)) {
69
-        return $constants[$mapping[$key]];
70
-      }
71
-    }
72
-
73
-    throw new ValueNotValid($name, get_called_class(), "getValues");
60
+	$constants = self::getConstants();
61
+	if ($strict) {
62
+	  if (array_key_exists($name, $constants)) {
63
+		return $constants[$name];
64
+	  }
65
+	} else {
66
+	  $mapping = self::getCaseMapping();
67
+	  $key = strtolower($name);
68
+	  if (array_key_exists($key, $mapping)) {
69
+		return $constants[$mapping[$key]];
70
+	  }
71
+	}
72
+
73
+	throw new ValueNotValid($name, get_called_class(), "getValues");
74 74
   }
75 75
 
76 76
   /**
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
    */
80 80
   public static function getValues(): array
81 81
   {
82
-    return array_values(self::getConstants());
82
+	return array_values(self::getConstants());
83 83
   }
84 84
 
85 85
   /**
@@ -90,14 +90,14 @@  discard block
 block discarded – undo
90 90
    */
91 91
   public static function isValidName(string $name, bool $strict = false): bool
92 92
   {
93
-    $constants = self::getConstants();
93
+	$constants = self::getConstants();
94 94
 
95
-    if ($strict) {
96
-      return array_key_exists($name, $constants);
97
-    }
95
+	if ($strict) {
96
+	  return array_key_exists($name, $constants);
97
+	}
98 98
 
99
-    $keys = array_map('strtolower', array_keys($constants));
100
-    return in_array(strtolower($name), $keys);
99
+	$keys = array_map('strtolower', array_keys($constants));
100
+	return in_array(strtolower($name), $keys);
101 101
   }
102 102
 
103 103
   /**
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
108 108
    */
109 109
   public static function isValidValue($value, bool $strict = true): bool
110 110
   {
111
-    $values = self::getValues();
112
-    return in_array($value, $values, $strict);
111
+	$values = self::getValues();
112
+	return in_array($value, $values, $strict);
113 113
   }
114 114
 //</editor-fold desc="Public Methods">
115 115
 
@@ -121,17 +121,17 @@  discard block
 block discarded – undo
121 121
    */
122 122
   private static function getCaseMapping(): array
123 123
   {
124
-    if (self::$constCacheArrayCaseMapping == NULL) {
125
-      self::$constCacheArrayCaseMapping = [];
126
-    }
127
-    $calledClass = get_called_class();
128
-    if (!array_key_exists($calledClass, self::$constCacheArrayCaseMapping)) {
129
-      self::$constCacheArrayCaseMapping[$calledClass] = [];
130
-      foreach (self::getNames() as $name) {
131
-        self::$constCacheArrayCaseMapping[$calledClass][strtolower($name)] = $name;
132
-      }
133
-    }
134
-    return self::$constCacheArrayCaseMapping[$calledClass];
124
+	if (self::$constCacheArrayCaseMapping == NULL) {
125
+	  self::$constCacheArrayCaseMapping = [];
126
+	}
127
+	$calledClass = get_called_class();
128
+	if (!array_key_exists($calledClass, self::$constCacheArrayCaseMapping)) {
129
+	  self::$constCacheArrayCaseMapping[$calledClass] = [];
130
+	  foreach (self::getNames() as $name) {
131
+		self::$constCacheArrayCaseMapping[$calledClass][strtolower($name)] = $name;
132
+	  }
133
+	}
134
+	return self::$constCacheArrayCaseMapping[$calledClass];
135 135
   }
136 136
 
137 137
   /** @noinspection PhpDocMissingThrowsInspection */ //ReflectionException
@@ -141,19 +141,19 @@  discard block
 block discarded – undo
141 141
    */
142 142
   private static function getConstants(): array
143 143
   {
144
-    if (self::$constCacheArray == NULL) {
145
-      self::$constCacheArray = [];
146
-    }
147
-    $calledClass = get_called_class();
148
-    if (!array_key_exists($calledClass, self::$constCacheArray)) {
149
-      // ReflectionException => whe know that calledClass is a valid class since it is the result of get_called_class
150
-      /** @noinspection PhpUnhandledExceptionInspection */
151
-      $reflect = new \ReflectionClass($calledClass);
152
-      $array = $reflect->getConstants();
153
-      asort($array);
154
-      self::$constCacheArray[$calledClass] = $array;
155
-    }
156
-    return self::$constCacheArray[$calledClass];
144
+	if (self::$constCacheArray == NULL) {
145
+	  self::$constCacheArray = [];
146
+	}
147
+	$calledClass = get_called_class();
148
+	if (!array_key_exists($calledClass, self::$constCacheArray)) {
149
+	  // ReflectionException => whe know that calledClass is a valid class since it is the result of get_called_class
150
+	  /** @noinspection PhpUnhandledExceptionInspection */
151
+	  $reflect = new \ReflectionClass($calledClass);
152
+	  $array = $reflect->getConstants();
153
+	  asort($array);
154
+	  self::$constCacheArray[$calledClass] = $array;
155
+	}
156
+	return self::$constCacheArray[$calledClass];
157 157
   }
158 158
 //</editor-fold desc="Private Methods">
159 159
 }
160 160
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 /**
4 4
  * Created by PhpStorm.
5 5
  * User: benedikt
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
    * @param bool $strict if yes type checks are performed
33 33
    * @throws ValueNotValid if the value is not valid
34 34
    */
35
-  public static function ensureValidValue($value, bool $strict = true): void
35
+  public static function ensureValidValue( $value, bool $strict = true ): void
36 36
   {
37
-    if (!self::isValidValue($value, $strict)) {
37
+    if ( !self::isValidValue($value, $strict) ) {
38 38
       throw new ValueNotValid($value, get_called_class());
39 39
     }
40 40
   }
@@ -55,17 +55,17 @@  discard block
 block discarded – undo
55 55
    * @return mixed the corresponding value
56 56
    * @throws ValueNotValid if the name is not valid
57 57
    */
58
-  public static function getValue(string $name, bool $strict = false)
58
+  public static function getValue( string $name, bool $strict = false )
59 59
   {
60 60
     $constants = self::getConstants();
61
-    if ($strict) {
62
-      if (array_key_exists($name, $constants)) {
61
+    if ( $strict ) {
62
+      if ( array_key_exists($name, $constants) ) {
63 63
         return $constants[$name];
64 64
       }
65 65
     } else {
66 66
       $mapping = self::getCaseMapping();
67 67
       $key = strtolower($name);
68
-      if (array_key_exists($key, $mapping)) {
68
+      if ( array_key_exists($key, $mapping) ) {
69 69
         return $constants[$mapping[$key]];
70 70
       }
71 71
     }
@@ -88,11 +88,11 @@  discard block
 block discarded – undo
88 88
    * @param bool $strict if yes check is done case sensitive and otherwise case insensitive
89 89
    * @return bool true if the name is part of the enum and false otherwise
90 90
    */
91
-  public static function isValidName(string $name, bool $strict = false): bool
91
+  public static function isValidName( string $name, bool $strict = false ): bool
92 92
   {
93 93
     $constants = self::getConstants();
94 94
 
95
-    if ($strict) {
95
+    if ( $strict ) {
96 96
       return array_key_exists($name, $constants);
97 97
     }
98 98
 
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
    * @param bool $strict if yes type checks are performed
107 107
    * @return bool true if the value is part of the enum and false otherwise
108 108
    */
109
-  public static function isValidValue($value, bool $strict = true): bool
109
+  public static function isValidValue( $value, bool $strict = true ): bool
110 110
   {
111 111
     $values = self::getValues();
112 112
     return in_array($value, $values, $strict);
@@ -121,13 +121,13 @@  discard block
 block discarded – undo
121 121
    */
122 122
   private static function getCaseMapping(): array
123 123
   {
124
-    if (self::$constCacheArrayCaseMapping == NULL) {
124
+    if ( self::$constCacheArrayCaseMapping == NULL ) {
125 125
       self::$constCacheArrayCaseMapping = [];
126 126
     }
127 127
     $calledClass = get_called_class();
128
-    if (!array_key_exists($calledClass, self::$constCacheArrayCaseMapping)) {
128
+    if ( !array_key_exists($calledClass, self::$constCacheArrayCaseMapping) ) {
129 129
       self::$constCacheArrayCaseMapping[$calledClass] = [];
130
-      foreach (self::getNames() as $name) {
130
+      foreach ( self::getNames() as $name ) {
131 131
         self::$constCacheArrayCaseMapping[$calledClass][strtolower($name)] = $name;
132 132
       }
133 133
     }
@@ -141,11 +141,11 @@  discard block
 block discarded – undo
141 141
    */
142 142
   private static function getConstants(): array
143 143
   {
144
-    if (self::$constCacheArray == NULL) {
144
+    if ( self::$constCacheArray == NULL ) {
145 145
       self::$constCacheArray = [];
146 146
     }
147 147
     $calledClass = get_called_class();
148
-    if (!array_key_exists($calledClass, self::$constCacheArray)) {
148
+    if ( !array_key_exists($calledClass, self::$constCacheArray) ) {
149 149
       // ReflectionException => whe know that calledClass is a valid class since it is the result of get_called_class
150 150
       /** @noinspection PhpUnhandledExceptionInspection */
151 151
       $reflect = new \ReflectionClass($calledClass);
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,8 +15,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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)) {
Please login to merge, or discard this patch.
Upper-Lower-Casing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,10 +19,10 @@  discard block
 block discarded – undo
19 19
 {
20 20
 //<editor-fold desc="Fields">
21 21
   /** @var null|mixed[][] */
22
-  private static $constCacheArray = NULL;
22
+  private static $constCacheArray = null;
23 23
 
24 24
   /** @var null|string[][] */
25
-  private static $constCacheArrayCaseMapping = NULL;
25
+  private static $constCacheArrayCaseMapping = null;
26 26
 //</editor-fold desc="Fields">
27 27
 
28 28
 //<editor-fold desc="Public Methods">
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
    */
122 122
   private static function getCaseMapping(): array
123 123
   {
124
-    if (self::$constCacheArrayCaseMapping == NULL) {
124
+    if (self::$constCacheArrayCaseMapping == null) {
125 125
       self::$constCacheArrayCaseMapping = [];
126 126
     }
127 127
     $calledClass = get_called_class();
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
    */
142 142
   private static function getConstants(): array
143 143
   {
144
-    if (self::$constCacheArray == NULL) {
144
+    if (self::$constCacheArray == null) {
145 145
       self::$constCacheArray = [];
146 146
     }
147 147
     $calledClass = get_called_class();
Please login to merge, or discard this patch.
src/Providers/FmLibServiceProvider.php 3 patches
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
    */
45 45
   public function boot()
46 46
   {
47
-    include __DIR__ . '/../routes.php';
47
+	include __DIR__ . '/../routes.php';
48 48
   }
49 49
 
50 50
   /** @noinspection PhpDocMissingThrowsInspection */ //\Doctrine\DBAL\DBALException
@@ -55,42 +55,42 @@  discard block
 block discarded – undo
55 55
    */
56 56
   public function register()
57 57
   {
58
-    //register middleware
59
-    app()->routeMiddleware(['auth' => Authenticate::class]);
58
+	//register middleware
59
+	app()->routeMiddleware(['auth' => Authenticate::class]);
60 60
 
61
-    $this->app->singleton(
62
-      ExceptionHandler::class,
63
-      Handler::class
64
-    );
61
+	$this->app->singleton(
62
+	  ExceptionHandler::class,
63
+	  Handler::class
64
+	);
65 65
 
66
-    if ($this->app->environment() !== 'production') {
67
-      if (class_exists('\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider')) {
68
-        $this->app->register('\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider');
69
-      }
70
-    }
66
+	if ($this->app->environment() !== 'production') {
67
+	  if (class_exists('\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider')) {
68
+		$this->app->register('\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider');
69
+	  }
70
+	}
71 71
 
72
-    /** @noinspection PhpUnhandledExceptionInspection */ // \Doctrine\DBAL\DBALException datetime is a valid type
73
-    Type::overrideType('datetime', UTCDateTimeType::class);
72
+	/** @noinspection PhpUnhandledExceptionInspection */ // \Doctrine\DBAL\DBALException datetime is a valid type
73
+	Type::overrideType('datetime', UTCDateTimeType::class);
74 74
 
75
-    $this->app->register(LumenServiceProvider::class);
76
-    $this->app->register(DoctrineServiceProvider::class);
77
-    $this->app->register(GedmoExtensionsServiceProvider::class);
78
-    $this->app->register(JwtAuthGuardServiceProvider::class);
75
+	$this->app->register(LumenServiceProvider::class);
76
+	$this->app->register(DoctrineServiceProvider::class);
77
+	$this->app->register(GedmoExtensionsServiceProvider::class);
78
+	$this->app->register(JwtAuthGuardServiceProvider::class);
79 79
 
80
-    $this->app->singleton(DynamicServiceLoadingServiceInterface::class, function (Container $app) {
81
-      return new DynamicServiceLoadingService($app);
82
-    });
80
+	$this->app->singleton(DynamicServiceLoadingServiceInterface::class, function (Container $app) {
81
+	  return new DynamicServiceLoadingService($app);
82
+	});
83 83
 
84
-    $this->app->singleton(RankingSystemServiceInterface::class, function (Container $app) {
85
-      return new RankingSystemService($app->make(DynamicServiceLoadingServiceInterface::class),
86
-        $app->make(EntityManagerInterface::class));
87
-    });
84
+	$this->app->singleton(RankingSystemServiceInterface::class, function (Container $app) {
85
+	  return new RankingSystemService($app->make(DynamicServiceLoadingServiceInterface::class),
86
+		$app->make(EntityManagerInterface::class));
87
+	});
88 88
 
89
-    $this->app->singleton(EloRankingInterface::class, function (Container $app) {
90
-      $timeService = new RecursiveEndStartTimeService();
91
-      $entityComparer = new EntityComparerByTimeStartTimeAndLocalIdentifier($timeService);
92
-      return new EloRanking($app->make(EntityManagerInterface::class), $timeService, $entityComparer);
93
-    });
89
+	$this->app->singleton(EloRankingInterface::class, function (Container $app) {
90
+	  $timeService = new RecursiveEndStartTimeService();
91
+	  $entityComparer = new EntityComparerByTimeStartTimeAndLocalIdentifier($timeService);
92
+	  return new EloRanking($app->make(EntityManagerInterface::class), $timeService, $entityComparer);
93
+	});
94 94
   }
95 95
 //</editor-fold desc="Public Methods">
96 96
 }
97 97
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 /**
4 4
  * Created by PhpStorm.
5 5
  * User: benedikt
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
    */
45 45
   public function boot()
46 46
   {
47
-    include __DIR__ . '/../routes.php';
47
+    include __DIR__.'/../routes.php';
48 48
   }
49 49
 
50 50
   /** @noinspection PhpDocMissingThrowsInspection */ //\Doctrine\DBAL\DBALException
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
       Handler::class
64 64
     );
65 65
 
66
-    if ($this->app->environment() !== 'production') {
67
-      if (class_exists('\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider')) {
66
+    if ( $this->app->environment() !== 'production' ) {
67
+      if ( class_exists('\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider') ) {
68 68
         $this->app->register('\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider');
69 69
       }
70 70
     }
@@ -77,16 +77,16 @@  discard block
 block discarded – undo
77 77
     $this->app->register(GedmoExtensionsServiceProvider::class);
78 78
     $this->app->register(JwtAuthGuardServiceProvider::class);
79 79
 
80
-    $this->app->singleton(DynamicServiceLoadingServiceInterface::class, function (Container $app) {
80
+    $this->app->singleton(DynamicServiceLoadingServiceInterface::class, function( Container $app ) {
81 81
       return new DynamicServiceLoadingService($app);
82 82
     });
83 83
 
84
-    $this->app->singleton(RankingSystemServiceInterface::class, function (Container $app) {
84
+    $this->app->singleton(RankingSystemServiceInterface::class, function( Container $app ) {
85 85
       return new RankingSystemService($app->make(DynamicServiceLoadingServiceInterface::class),
86 86
         $app->make(EntityManagerInterface::class));
87 87
     });
88 88
 
89
-    $this->app->singleton(EloRankingInterface::class, function (Container $app) {
89
+    $this->app->singleton(EloRankingInterface::class, function( Container $app ) {
90 90
       $timeService = new RecursiveEndStartTimeService();
91 91
       $entityComparer = new EntityComparerByTimeStartTimeAndLocalIdentifier($timeService);
92 92
       return new EloRanking($app->make(EntityManagerInterface::class), $timeService, $entityComparer);
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -34,16 +34,14 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/TestHelpers/LumenTestCase.php 3 patches
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -30,39 +30,39 @@
 block discarded – undo
30 30
    */
31 31
   protected function checkProperties(array $data, $object, array $properties, array $enumProperties = [])
32 32
   {
33
-    foreach ($properties as $property => $default) {
34
-      $getter = 'get' . ucfirst($property);
35
-      if (!method_exists($object, $getter)) {
36
-        $getter = 'is' . ucfirst($property);
37
-      }
38
-      $transformer = null;
39
-      if (is_array($default) && array_key_exists('transformer', $default)) {
40
-        $transformer = $default['transformer'];
41
-        $default = $default['default'];
42
-      }
43
-      if (array_key_exists($property, $data)) {
44
-        $value = $data[$property];
45
-        if ($transformer != null) {
46
-          $value = $transformer($value);
47
-        }
48
-        self::assertEquals($value, $object->$getter());
49
-      } else {
50
-        self::assertEquals($default, $object->$getter());
51
-      }
52
-    }
33
+	foreach ($properties as $property => $default) {
34
+	  $getter = 'get' . ucfirst($property);
35
+	  if (!method_exists($object, $getter)) {
36
+		$getter = 'is' . ucfirst($property);
37
+	  }
38
+	  $transformer = null;
39
+	  if (is_array($default) && array_key_exists('transformer', $default)) {
40
+		$transformer = $default['transformer'];
41
+		$default = $default['default'];
42
+	  }
43
+	  if (array_key_exists($property, $data)) {
44
+		$value = $data[$property];
45
+		if ($transformer != null) {
46
+		  $value = $transformer($value);
47
+		}
48
+		self::assertEquals($value, $object->$getter());
49
+	  } else {
50
+		self::assertEquals($default, $object->$getter());
51
+	  }
52
+	}
53 53
 
54
-    foreach ($enumProperties as $property => $info) {
55
-      $enumClass = $info['enum'];
56
-      $default = $info['default'];
57
-      $getter = 'get' . ucfirst($property);
58
-      if (array_key_exists($property, $data)) {
59
-        $name = $data[$property];
60
-        /** @noinspection PhpUndefinedMethodInspection */
61
-        self::assertEquals($enumClass::getValue($name), $object->$getter());
62
-      } else {
63
-        self::assertEquals($default, $object->$getter());
64
-      }
65
-    }
54
+	foreach ($enumProperties as $property => $info) {
55
+	  $enumClass = $info['enum'];
56
+	  $default = $info['default'];
57
+	  $getter = 'get' . ucfirst($property);
58
+	  if (array_key_exists($property, $data)) {
59
+		$name = $data[$property];
60
+		/** @noinspection PhpUndefinedMethodInspection */
61
+		self::assertEquals($enumClass::getValue($name), $object->$getter());
62
+	  } else {
63
+		self::assertEquals($default, $object->$getter());
64
+	  }
65
+	}
66 66
   }
67 67
 //</editor-fold desc="Protected Methods">
68 68
 }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 /**
5 5
  * Class TestCase
@@ -28,21 +28,21 @@  discard block
 block discarded – undo
28 28
    * @param mixed[] $enumProperties the enum properties to check, property name maps to an info array, which contains
29 29
    *                                the enum name and the default value
30 30
    */
31
-  protected function checkProperties(array $data, $object, array $properties, array $enumProperties = [])
31
+  protected function checkProperties( array $data, $object, array $properties, array $enumProperties = [] )
32 32
   {
33
-    foreach ($properties as $property => $default) {
34
-      $getter = 'get' . ucfirst($property);
35
-      if (!method_exists($object, $getter)) {
36
-        $getter = 'is' . ucfirst($property);
33
+    foreach ( $properties as $property => $default ) {
34
+      $getter = 'get'.ucfirst($property);
35
+      if ( !method_exists($object, $getter) ) {
36
+        $getter = 'is'.ucfirst($property);
37 37
       }
38 38
       $transformer = null;
39
-      if (is_array($default) && array_key_exists('transformer', $default)) {
39
+      if ( is_array($default) && array_key_exists('transformer', $default) ) {
40 40
         $transformer = $default['transformer'];
41 41
         $default = $default['default'];
42 42
       }
43
-      if (array_key_exists($property, $data)) {
43
+      if ( array_key_exists($property, $data) ) {
44 44
         $value = $data[$property];
45
-        if ($transformer != null) {
45
+        if ( $transformer != null ) {
46 46
           $value = $transformer($value);
47 47
         }
48 48
         self::assertEquals($value, $object->$getter());
@@ -51,11 +51,11 @@  discard block
 block discarded – undo
51 51
       }
52 52
     }
53 53
 
54
-    foreach ($enumProperties as $property => $info) {
54
+    foreach ( $enumProperties as $property => $info ) {
55 55
       $enumClass = $info['enum'];
56 56
       $default = $info['default'];
57
-      $getter = 'get' . ucfirst($property);
58
-      if (array_key_exists($property, $data)) {
57
+      $getter = 'get'.ucfirst($property);
58
+      if ( array_key_exists($property, $data) ) {
59 59
         $name = $data[$property];
60 60
         /** @noinspection PhpUndefinedMethodInspection */
61 61
         self::assertEquals($enumClass::getValue($name), $object->$getter());
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -13,8 +13,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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)) {
Please login to merge, or discard this patch.
src/TestHelpers/AuthenticatedTestCase.php 3 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -46,39 +46,39 @@
 block discarded – undo
46 46
    */
47 47
   protected function jsonAuth(string $method, string $uri, array $data = [], array $headers = [])
48 48
   {
49
-    $headers['Authorization'] = 'Bearer ' . $this->token;
50
-    return $this->json($method, $uri, $data, $headers);
49
+	$headers['Authorization'] = 'Bearer ' . $this->token;
50
+	return $this->json($method, $uri, $data, $headers);
51 51
   }
52 52
 
53 53
   protected function workOnDatabaseDestroy()
54 54
   {
55
-    $this->clearUsers();
56
-    parent::workOnDatabaseDestroy();
55
+	$this->clearUsers();
56
+	parent::workOnDatabaseDestroy();
57 57
   }
58 58
 
59 59
   protected function workOnDatabaseSetUp()
60 60
   {
61
-    $this->clearUsers();
62
-    parent::workOnDatabaseSetUp();
63
-    $password = $this->newPassword();
64
-    $this->user = entity(User::class)->create(['originalPassword' => $password]);
65
-    /** @noinspection PhpUnhandledExceptionInspection */
66
-    $this->token = Auth::attempt(['email' => $this->user->getEmail(), 'password' => $password]);
67
-    $this->refreshApplication();
68
-    /** @noinspection PhpUndefinedMethodInspection */
69
-    $this->user = EntityManager::find(User::class, $this->user->getId());
61
+	$this->clearUsers();
62
+	parent::workOnDatabaseSetUp();
63
+	$password = $this->newPassword();
64
+	$this->user = entity(User::class)->create(['originalPassword' => $password]);
65
+	/** @noinspection PhpUnhandledExceptionInspection */
66
+	$this->token = Auth::attempt(['email' => $this->user->getEmail(), 'password' => $password]);
67
+	$this->refreshApplication();
68
+	/** @noinspection PhpUndefinedMethodInspection */
69
+	$this->user = EntityManager::find(User::class, $this->user->getId());
70 70
   }
71 71
 //</editor-fold desc="Protected Methods">
72 72
 
73 73
 //<editor-fold desc="Private Methods">
74 74
   private function clearUsers()
75 75
   {
76
-    /** @var Connection $connection */
77
-    /** @noinspection PhpUndefinedMethodInspection */
78
-    $connection = EntityManager::getConnection();
79
-    $sql = sprintf('SET FOREIGN_KEY_CHECKS=0;TRUNCATE TABLE %s;SET FOREIGN_KEY_CHECKS=1;', "users");
80
-    /** @noinspection PhpUnhandledExceptionInspection */
81
-    $connection->query($sql);
76
+	/** @var Connection $connection */
77
+	/** @noinspection PhpUndefinedMethodInspection */
78
+	$connection = EntityManager::getConnection();
79
+	$sql = sprintf('SET FOREIGN_KEY_CHECKS=0;TRUNCATE TABLE %s;SET FOREIGN_KEY_CHECKS=1;', "users");
80
+	/** @noinspection PhpUnhandledExceptionInspection */
81
+	$connection->query($sql);
82 82
   }
83 83
 //</editor-fold desc="Private Methods">
84 84
 }
85 85
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 /**
5 5
  * Created by PhpStorm.
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
    * @param array $headers the request headers
45 45
    * @return $this
46 46
    */
47
-  protected function jsonAuth(string $method, string $uri, array $data = [], array $headers = [])
47
+  protected function jsonAuth( string $method, string $uri, array $data = [], array $headers = [] )
48 48
   {
49
-    $headers['Authorization'] = 'Bearer ' . $this->token;
49
+    $headers['Authorization'] = 'Bearer '.$this->token;
50 50
     return $this->json($method, $uri, $data, $headers);
51 51
   }
52 52
 
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -19,8 +19,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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();
Please login to merge, or discard this patch.
src/TestHelpers/DatabaseTestCase.php 3 patches
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -41,10 +41,10 @@  discard block
 block discarded – undo
41 41
    */
42 42
   public function __construct($name = null, array $data = [], $dataName = '', $clear = false)
43 43
   {
44
-    parent::__construct($name, $data, $dataName);
45
-    srand(3); //always use the same faker values to get reproducibility
46
-    $this->faker = Factory::create();
47
-    $this->clear = $clear;
44
+	parent::__construct($name, $data, $dataName);
45
+	srand(3); //always use the same faker values to get reproducibility
46
+	$this->faker = Factory::create();
47
+	$this->clear = $clear;
48 48
   }
49 49
 //</editor-fold desc="Constructor">
50 50
 
@@ -56,16 +56,16 @@  discard block
 block discarded – undo
56 56
    */
57 57
   protected function clearDatabase()
58 58
   {
59
-    /** @var \Doctrine\DBAL\Connection $connection */
60
-    /** @noinspection PhpUndefinedMethodInspection */
61
-    $connection = EntityManager::getConnection();
62
-    $connection->query(sprintf('SET FOREIGN_KEY_CHECKS = 0;'));
63
-    $tables = $connection->getSchemaManager()->listTables();
64
-    foreach ($tables as $table) {
65
-      $sql = sprintf('TRUNCATE TABLE %s', $table->getName());
66
-      $connection->query($sql);
67
-    }
68
-    $connection->query(sprintf('SET FOREIGN_KEY_CHECKS = 1;'));
59
+	/** @var \Doctrine\DBAL\Connection $connection */
60
+	/** @noinspection PhpUndefinedMethodInspection */
61
+	$connection = EntityManager::getConnection();
62
+	$connection->query(sprintf('SET FOREIGN_KEY_CHECKS = 0;'));
63
+	$tables = $connection->getSchemaManager()->listTables();
64
+	foreach ($tables as $table) {
65
+	  $sql = sprintf('TRUNCATE TABLE %s', $table->getName());
66
+	  $connection->query($sql);
67
+	}
68
+	$connection->query(sprintf('SET FOREIGN_KEY_CHECKS = 1;'));
69 69
   }
70 70
 
71 71
   /**
@@ -75,11 +75,11 @@  discard block
 block discarded – undo
75 75
    */
76 76
   protected function createPlayers(int $number = 1): array
77 77
   {
78
-    $result = [];
79
-    for ($i = 0; $i < $number; $i++) {
80
-      $result[] = entity(Player::class)->create();
81
-    }
82
-    return $result;
78
+	$result = [];
79
+	for ($i = 0; $i < $number; $i++) {
80
+	  $result[] = entity(Player::class)->create();
81
+	}
82
+	return $result;
83 83
   }
84 84
 
85 85
   /**
@@ -90,16 +90,16 @@  discard block
 block discarded – undo
90 90
    */
91 91
   protected function createTeams(int $number, $playerPerTeam = 1): array
92 92
   {
93
-    $result = [];
94
-    for ($i = 0; $i < $number; $i++) {
95
-      /** @var Team $team */
96
-      $team = entity(Team::class)->create(['startNumber' => $i + 1, 'rank' => $number - $i]);
97
-      foreach ($this->createPlayers($playerPerTeam) as $player) {
98
-        $team->getPlayers()->add($player);
99
-      }
100
-      $result[] = $team;
101
-    }
102
-    return $result;
93
+	$result = [];
94
+	for ($i = 0; $i < $number; $i++) {
95
+	  /** @var Team $team */
96
+	  $team = entity(Team::class)->create(['startNumber' => $i + 1, 'rank' => $number - $i]);
97
+	  foreach ($this->createPlayers($playerPerTeam) as $player) {
98
+		$team->getPlayers()->add($player);
99
+	  }
100
+	  $result[] = $team;
101
+	}
102
+	return $result;
103 103
   }
104 104
 
105 105
   /**
@@ -108,13 +108,13 @@  discard block
 block discarded – undo
108 108
    */
109 109
   protected function createUser()
110 110
   {
111
-    $password = $this->newPassword();
112
-    /** @var User $user */
113
-    $user = entity(User::class)->create(['originalPassword' => $password]);
114
-    return [
115
-      'password' => $password,
116
-      'user' => $user
117
-    ];
111
+	$password = $this->newPassword();
112
+	/** @var User $user */
113
+	$user = entity(User::class)->create(['originalPassword' => $password]);
114
+	return [
115
+	  'password' => $password,
116
+	  'user' => $user
117
+	];
118 118
   }
119 119
 
120 120
   /**
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
    */
124 124
   protected function newPassword()
125 125
   {
126
-    return $this->faker->password(8, 30);
126
+	return $this->faker->password(8, 30);
127 127
   }
128 128
 
129 129
   /**
@@ -134,28 +134,28 @@  discard block
 block discarded – undo
134 134
    */
135 135
   protected function setUpTraits()
136 136
   {
137
-    srand(3); //always use the same faker values to get reproducibility
138
-    $clear = $this->clear;
139
-    parent::setUpTraits();
140
-    if ($clear) {
141
-      $this->clearDatabase();
142
-      $this->workOnDatabaseSetUp();
143
-    } else {
144
-      $this->workOnDatabaseSetUp();
145
-      /** @noinspection PhpUndefinedMethodInspection */
146
-      EntityManager::beginTransaction();
147
-    }
148
-
149
-    $this->beforeApplicationDestroyed(function () use ($clear) {
150
-      if ($clear) {
151
-        $this->workOnDatabaseDestroy();
152
-        $this->clearDatabase();
153
-      } else {
154
-        /** @noinspection PhpUndefinedMethodInspection */
155
-        EntityManager::rollback();
156
-        $this->workOnDatabaseDestroy();
157
-      }
158
-    });
137
+	srand(3); //always use the same faker values to get reproducibility
138
+	$clear = $this->clear;
139
+	parent::setUpTraits();
140
+	if ($clear) {
141
+	  $this->clearDatabase();
142
+	  $this->workOnDatabaseSetUp();
143
+	} else {
144
+	  $this->workOnDatabaseSetUp();
145
+	  /** @noinspection PhpUndefinedMethodInspection */
146
+	  EntityManager::beginTransaction();
147
+	}
148
+
149
+	$this->beforeApplicationDestroyed(function () use ($clear) {
150
+	  if ($clear) {
151
+		$this->workOnDatabaseDestroy();
152
+		$this->clearDatabase();
153
+	  } else {
154
+		/** @noinspection PhpUndefinedMethodInspection */
155
+		EntityManager::rollback();
156
+		$this->workOnDatabaseDestroy();
157
+	  }
158
+	});
159 159
   }
160 160
 
161 161
   protected function workOnDatabaseDestroy()
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 /**
5 5
  * Class DatabaseTestCase
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
    * @param string $dataName test data name
40 40
    * @param bool $clear
41 41
    */
42
-  public function __construct($name = null, array $data = [], $dataName = '', $clear = false)
42
+  public function __construct( $name = null, array $data = [], $dataName = '', $clear = false )
43 43
   {
44 44
     parent::__construct($name, $data, $dataName);
45 45
     srand(3); //always use the same faker values to get reproducibility
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
     $connection = EntityManager::getConnection();
62 62
     $connection->query(sprintf('SET FOREIGN_KEY_CHECKS = 0;'));
63 63
     $tables = $connection->getSchemaManager()->listTables();
64
-    foreach ($tables as $table) {
64
+    foreach ( $tables as $table ) {
65 65
       $sql = sprintf('TRUNCATE TABLE %s', $table->getName());
66 66
       $connection->query($sql);
67 67
     }
@@ -73,10 +73,10 @@  discard block
 block discarded – undo
73 73
    * @param int $number the number of players
74 74
    * @return Player[] the created player array
75 75
    */
76
-  protected function createPlayers(int $number = 1): array
76
+  protected function createPlayers( int $number = 1 ): array
77 77
   {
78 78
     $result = [];
79
-    for ($i = 0; $i < $number; $i++) {
79
+    for ( $i = 0; $i < $number; $i++ ) {
80 80
       $result[] = entity(Player::class)->create();
81 81
     }
82 82
     return $result;
@@ -88,13 +88,13 @@  discard block
 block discarded – undo
88 88
    * @param int $playerPerTeam the number of players per team
89 89
    * @return Team[] the created team array
90 90
    */
91
-  protected function createTeams(int $number, $playerPerTeam = 1): array
91
+  protected function createTeams( int $number, $playerPerTeam = 1 ): array
92 92
   {
93 93
     $result = [];
94
-    for ($i = 0; $i < $number; $i++) {
94
+    for ( $i = 0; $i < $number; $i++ ) {
95 95
       /** @var Team $team */
96 96
       $team = entity(Team::class)->create(['startNumber' => $i + 1, 'rank' => $number - $i]);
97
-      foreach ($this->createPlayers($playerPerTeam) as $player) {
97
+      foreach ( $this->createPlayers($playerPerTeam) as $player ) {
98 98
         $team->getPlayers()->add($player);
99 99
       }
100 100
       $result[] = $team;
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
     srand(3); //always use the same faker values to get reproducibility
138 138
     $clear = $this->clear;
139 139
     parent::setUpTraits();
140
-    if ($clear) {
140
+    if ( $clear ) {
141 141
       $this->clearDatabase();
142 142
       $this->workOnDatabaseSetUp();
143 143
     } else {
@@ -146,8 +146,8 @@  discard block
 block discarded – undo
146 146
       EntityManager::beginTransaction();
147 147
     }
148 148
 
149
-    $this->beforeApplicationDestroyed(function () use ($clear) {
150
-      if ($clear) {
149
+    $this->beforeApplicationDestroyed(function() use ($clear) {
150
+      if ( $clear ) {
151 151
         $this->workOnDatabaseDestroy();
152 152
         $this->clearDatabase();
153 153
       } else {
Please login to merge, or discard this patch.
Braces   +8 added lines, -16 removed lines patch added patch discarded remove patch
@@ -17,8 +17,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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">
Please login to merge, or discard this patch.
src/TestHelpers/ReflectionMethods.php 3 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -26,9 +26,9 @@  discard block
 block discarded – undo
26 26
    */
27 27
   protected static function callProtectedMethod($object, string $method, array $args = [])
28 28
   {
29
-    // ReflectionException => get_class is a valid class
30
-    /** @noinspection PhpUnhandledExceptionInspection */
31
-    return self::getMethod(get_class($object), $method)->invokeArgs($object, $args);
29
+	// ReflectionException => get_class is a valid class
30
+	/** @noinspection PhpUnhandledExceptionInspection */
31
+	return self::getMethod(get_class($object), $method)->invokeArgs($object, $args);
32 32
   }
33 33
 
34 34
   /**
@@ -40,10 +40,10 @@  discard block
 block discarded – undo
40 40
    */
41 41
   protected static function getMethod(string $class, string $name): \ReflectionMethod
42 42
   {
43
-    $class = new \ReflectionClass($class);
44
-    $method = $class->getMethod($name);
45
-    $method->setAccessible(true);
46
-    return $method;
43
+	$class = new \ReflectionClass($class);
44
+	$method = $class->getMethod($name);
45
+	$method->setAccessible(true);
46
+	return $method;
47 47
   }
48 48
 
49 49
   /**
@@ -55,13 +55,13 @@  discard block
 block discarded – undo
55 55
    */
56 56
   protected static function getProperty(string $class, string $name): \ReflectionProperty
57 57
   {
58
-    $class = new \ReflectionClass($class);
59
-    /** @noinspection PhpStatementHasEmptyBodyInspection */
60
-    while (!$class->hasProperty($name) && ($class = $class->getParentClass()) !== null) {
61
-    }
62
-    $property = $class->getProperty($name);
63
-    $property->setAccessible(true);
64
-    return $property;
58
+	$class = new \ReflectionClass($class);
59
+	/** @noinspection PhpStatementHasEmptyBodyInspection */
60
+	while (!$class->hasProperty($name) && ($class = $class->getParentClass()) !== null) {
61
+	}
62
+	$property = $class->getProperty($name);
63
+	$property->setAccessible(true);
64
+	return $property;
65 65
   }
66 66
 //</editor-fold desc="Protected Methods">
67 67
 }
68 68
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 /**
4 4
  * Created by PhpStorm.
5 5
  * User: benedikt
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
    * @param mixed[] $args the arguments for the method
25 25
    * @return mixed the return value of the method
26 26
    */
27
-  protected static function callProtectedMethod($object, string $method, array $args = [])
27
+  protected static function callProtectedMethod( $object, string $method, array $args = [] )
28 28
   {
29 29
     // ReflectionException => get_class is a valid class
30 30
     /** @noinspection PhpUnhandledExceptionInspection */
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
    * @return \ReflectionMethod the accessible method object
39 39
    * @throws \ReflectionException the given class does not exist
40 40
    */
41
-  protected static function getMethod(string $class, string $name): \ReflectionMethod
41
+  protected static function getMethod( string $class, string $name ): \ReflectionMethod
42 42
   {
43 43
     $class = new \ReflectionClass($class);
44 44
     $method = $class->getMethod($name);
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
    * @return \ReflectionProperty the accessible property object
54 54
    * @throws \ReflectionException the given class does not exist
55 55
    */
56
-  protected static function getProperty(string $class, string $name): \ReflectionProperty
56
+  protected static function getProperty( string $class, string $name ): \ReflectionProperty
57 57
   {
58 58
     $class = new \ReflectionClass($class);
59 59
     /** @noinspection PhpStatementHasEmptyBodyInspection */
60
-    while (!$class->hasProperty($name) && ($class = $class->getParentClass()) !== null) {
60
+    while ( !$class->hasProperty($name) && ($class = $class->getParentClass()) !== null ) {
61 61
     }
62 62
     $property = $class->getProperty($name);
63 63
     $property->setAccessible(true);
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -13,8 +13,7 @@  discard block
 block discarded – undo
13 13
  * Trait ReflectionMethods
14 14
  * @package Tests\Helpers
15 15
  */
16
-trait ReflectionMethods
17
-{
16
+trait ReflectionMethods {
18 17
 //<editor-fold desc="Protected Methods">
19 18
   /** @noinspection PhpDocMissingThrowsInspection */ //ReflectionException
20 19
   /**
@@ -24,8 +23,7 @@  discard block
 block discarded – undo
24 23
    * @param mixed[] $args the arguments for the method
25 24
    * @return mixed the return value of the method
26 25
    */
27
-  protected static function callProtectedMethod($object, string $method, array $args = [])
28
-  {
26
+  protected static function callProtectedMethod($object, string $method, array $args = []) {
29 27
     // ReflectionException => get_class is a valid class
30 28
     /** @noinspection PhpUnhandledExceptionInspection */
31 29
     return self::getMethod(get_class($object), $method)->invokeArgs($object, $args);
Please login to merge, or discard this patch.