Passed
Push — master ( 45960c...20d4cd )
by Glegrith
01:58
created
app/framework/Component/Database/Model/Console/MakeModelCommand.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -46,17 +46,17 @@
 block discarded – undo
46 46
     protected function execute(InputInterface $input, ConsoleOutput $output)
47 47
     {
48 48
         $migrationName = $input->getArgument("name");
49
-        $tableName =  $input->getArgument("tableName");
50
-        $connectionName =  $input->getArgument("connectionName");
49
+        $tableName = $input->getArgument("tableName");
50
+        $connectionName = $input->getArgument("connectionName");
51 51
 
52 52
         $template = str_replace("§NAME§", $migrationName, $this->template);
53 53
 
54
-        if(isset($connectionName))
54
+        if (isset($connectionName))
55 55
             $template = str_replace("§CONNECTION§", 'protected $connection = "'.$connectionName.'";', $template);
56 56
         else
57 57
             $template = str_replace("§CONNECTION§", '', $template);
58 58
 
59
-        if(isset($tableName))
59
+        if (isset($tableName))
60 60
             $template = str_replace("§TABLE§", 'protected $table = "'.$tableName.'";', $template);
61 61
         else
62 62
             $template = str_replace("§TABLE§", '', $template);
Please login to merge, or discard this patch.
Braces   +10 added lines, -8 removed lines patch added patch discarded remove patch
@@ -51,15 +51,17 @@
 block discarded – undo
51 51
 
52 52
         $template = str_replace("§NAME§", $migrationName, $this->template);
53 53
 
54
-        if(isset($connectionName))
55
-            $template = str_replace("§CONNECTION§", 'protected $connection = "'.$connectionName.'";', $template);
56
-        else
57
-            $template = str_replace("§CONNECTION§", '', $template);
54
+        if(isset($connectionName)) {
55
+                    $template = str_replace("§CONNECTION§", 'protected $connection = "'.$connectionName.'";', $template);
56
+        } else {
57
+                    $template = str_replace("§CONNECTION§", '', $template);
58
+        }
58 59
 
59
-        if(isset($tableName))
60
-            $template = str_replace("§TABLE§", 'protected $table = "'.$tableName.'";', $template);
61
-        else
62
-            $template = str_replace("§TABLE§", '', $template);
60
+        if(isset($tableName)) {
61
+                    $template = str_replace("§TABLE§", 'protected $table = "'.$tableName.'";', $template);
62
+        } else {
63
+                    $template = str_replace("§TABLE§", '', $template);
64
+        }
63 65
 
64 66
         $File = new File($migrationName.".php", new Storage("model"));
65 67
         //$File->setContents($template);
Please login to merge, or discard this patch.
app/framework/Component/Database/Model/Model.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@
 block discarded – undo
68 68
     public function __construct(Connection $connection = null)
69 69
     {
70 70
         $ConnFactory = new ConnectionFactory();
71
-        if(is_null($connection))
71
+        if (is_null($connection))
72 72
             $this->connection = $ConnFactory->make($this->connection);
73 73
         else
74 74
             $this->connection = $connection;
Please login to merge, or discard this patch.
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -68,10 +68,11 @@
 block discarded – undo
68 68
     public function __construct(Connection $connection = null)
69 69
     {
70 70
         $ConnFactory = new ConnectionFactory();
71
-        if(is_null($connection))
72
-            $this->connection = $ConnFactory->make($this->connection);
73
-        else
74
-            $this->connection = $connection;
71
+        if(is_null($connection)) {
72
+                    $this->connection = $ConnFactory->make($this->connection);
73
+        } else {
74
+                    $this->connection = $connection;
75
+        }
75 76
     }
76 77
 
77 78
     /**
Please login to merge, or discard this patch.
app/framework/Component/Database/Migrations/Commands/Migrate.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
     /**
25 25
      * @var Migration[] $migrations
26 26
      */
27
-    private $migrations = [];
27
+    private $migrations = [ ];
28 28
 
29 29
     protected function configure()
30 30
     {
@@ -60,24 +60,24 @@  discard block
 block discarded – undo
60 60
     private function setMigrations(ConsoleOutput $output)
61 61
     {
62 62
         // get all migrations
63
-        $classes   = [];
63
+        $classes   = [ ];
64 64
         $namespace = $this->namespace;
65 65
 
66
-        $path = str_replace("\\","/", $namespace);
66
+        $path = str_replace("\\", "/", $namespace);
67 67
         $filesInNamespace = new ArrayObject(scandir(ROOT_PATH."/".$path."/"));
68 68
         $filesInNamespace->removeFirst()->removeFirst();
69 69
 
70
-        for ($i = 0; $i <= $filesInNamespace->count()-1; $i++)
71
-            $filesInNamespace->key($i, explode(".php", $filesInNamespace->key($i))[0]);
70
+        for ($i = 0; $i <= $filesInNamespace->count() - 1; $i++)
71
+            $filesInNamespace->key($i, explode(".php", $filesInNamespace->key($i))[ 0 ]);
72 72
 
73 73
         foreach ($filesInNamespace->val() as $value) {
74 74
             $class = $namespace.$value;
75
-            if(class_exists($class) && is_subclass_of($class,'app\framework\Component\Database\Migrations\Migration'))
76
-                $classes[$value] = new $class();
75
+            if (class_exists($class) && is_subclass_of($class, 'app\framework\Component\Database\Migrations\Migration'))
76
+                $classes[ $value ] = new $class();
77 77
         }
78 78
 
79 79
         // tell user so if there are no migrations
80
-        if($classes == []) {
80
+        if ($classes == [ ]) {
81 81
             $output->writeln("No migrations found! You can Create migrations via the make:migration command.");
82 82
         } else {
83 83
             $this->migrations = $classes;
@@ -88,15 +88,15 @@  discard block
 block discarded – undo
88 88
     {
89 89
         $migrationInstance = null;
90 90
         $class = $this->namespace.$migration;
91
-        if(class_exists($class) && is_subclass_of($class,'app\framework\Component\Database\Migrations\Migration'))
91
+        if (class_exists($class) && is_subclass_of($class, 'app\framework\Component\Database\Migrations\Migration'))
92 92
             $migrationInstance = new $class();
93 93
 
94
-        if($migrationInstance == null) {
94
+        if ($migrationInstance == null) {
95 95
             $output->writeln("Migration not found");
96 96
         } else {
97 97
             // to make sure that only one element is in array
98
-            $this->migrations = [];
99
-            $this->migrations[] = $migrationInstance;
98
+            $this->migrations = [ ];
99
+            $this->migrations[ ] = $migrationInstance;
100 100
         }
101 101
     }
102 102
 }
Please login to merge, or discard this patch.
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -53,8 +53,9 @@  discard block
 block discarded – undo
53 53
             $class->up();
54 54
         }
55 55
 
56
-        if (count($this->migrations) > 0)
57
-            $output->writeln("Migration successful");
56
+        if (count($this->migrations) > 0) {
57
+                    $output->writeln("Migration successful");
58
+        }
58 59
     }
59 60
 
60 61
     private function setMigrations(ConsoleOutput $output)
@@ -67,13 +68,15 @@  discard block
 block discarded – undo
67 68
         $filesInNamespace = new ArrayObject(scandir(ROOT_PATH."/".$path."/"));
68 69
         $filesInNamespace->removeFirst()->removeFirst();
69 70
 
70
-        for ($i = 0; $i <= $filesInNamespace->count()-1; $i++)
71
-            $filesInNamespace->key($i, explode(".php", $filesInNamespace->key($i))[0]);
71
+        for ($i = 0; $i <= $filesInNamespace->count()-1; $i++) {
72
+                    $filesInNamespace->key($i, explode(".php", $filesInNamespace->key($i))[0]);
73
+        }
72 74
 
73 75
         foreach ($filesInNamespace->val() as $value) {
74 76
             $class = $namespace.$value;
75
-            if(class_exists($class) && is_subclass_of($class,'app\framework\Component\Database\Migrations\Migration'))
76
-                $classes[$value] = new $class();
77
+            if(class_exists($class) && is_subclass_of($class,'app\framework\Component\Database\Migrations\Migration')) {
78
+                            $classes[$value] = new $class();
79
+            }
77 80
         }
78 81
 
79 82
         // tell user so if there are no migrations
@@ -88,8 +91,9 @@  discard block
 block discarded – undo
88 91
     {
89 92
         $migrationInstance = null;
90 93
         $class = $this->namespace.$migration;
91
-        if(class_exists($class) && is_subclass_of($class,'app\framework\Component\Database\Migrations\Migration'))
92
-            $migrationInstance = new $class();
94
+        if(class_exists($class) && is_subclass_of($class,'app\framework\Component\Database\Migrations\Migration')) {
95
+                    $migrationInstance = new $class();
96
+        }
93 97
 
94 98
         if($migrationInstance == null) {
95 99
             $output->writeln("Migration not found");
Please login to merge, or discard this patch.
app/framework/Component/Database/Migrations/Commands/MakeMigration.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@
 block discarded – undo
72 72
         try {
73 73
             $File = new File($newMigrationName.".php", new Storage("migrations"));
74 74
 
75
-            if(fopen($File->getAbsolutePath(), "w")) {
75
+            if (fopen($File->getAbsolutePath(), "w")) {
76 76
                 $tempDefaultCommand = str_replace("§NAME§", $newMigrationName, $this->template);
77 77
                 $tempDefaultCommand = str_replace("§connection§", $connection, $tempDefaultCommand);
78 78
                 file_put_contents($File->getAbsolutePath(), $tempDefaultCommand);
Please login to merge, or discard this patch.
app/framework/Component/Database/Connection/Driver.php 2 patches
Spacing   +30 added lines, -31 removed lines patch added patch discarded remove patch
@@ -25,16 +25,16 @@  discard block
 block discarded – undo
25 25
 
26 26
         $attr = [
27 27
             'driver' => Driver::MySql,
28
-            'dbname' => $config['database']
28
+            'dbname' => $config[ 'database' ]
29 29
         ];
30 30
 
31
-        if (isset($config['socket'])) {
32
-            $attr['unix_socket'] = $config['socket'];
31
+        if (isset($config[ 'socket' ])) {
32
+            $attr[ 'unix_socket' ] = $config[ 'socket' ];
33 33
         } else {
34
-            $attr['host'] = $config['host'];
34
+            $attr[ 'host' ] = $config[ 'host' ];
35 35
 
36
-            if (isset($config["port"]))
37
-                $attr['port'] = $config["port"];
36
+            if (isset($config[ "port" ]))
37
+                $attr[ 'port' ] = $config[ "port" ];
38 38
         }
39 39
 
40 40
         self::parseDsn($dsn, $attr);
@@ -47,12 +47,12 @@  discard block
 block discarded – undo
47 47
 
48 48
         $attr = [
49 49
             'driver' => Driver::PgSql,
50
-            'host' => $config['host'],
51
-            'dbname' => $config['database']
50
+            'host' => $config[ 'host' ],
51
+            'dbname' => $config[ 'database' ]
52 52
         ];
53 53
 
54
-        if (isset($config["port"]))
55
-            $attr['port'] = $config["port"];
54
+        if (isset($config[ "port" ]))
55
+            $attr[ 'port' ] = $config[ "port" ];
56 56
 
57 57
         self::parseDsn($dsn, $attr);
58 58
         return $dsn;
@@ -64,12 +64,12 @@  discard block
 block discarded – undo
64 64
 
65 65
         $attr = [
66 66
             'driver' => Driver::DbLib,
67
-            'host' => $config['host'],
68
-            'dbname' => $config['database']
67
+            'host' => $config[ 'host' ],
68
+            'dbname' => $config[ 'database' ]
69 69
         ];
70 70
 
71
-        if (isset($config["port"]))
72
-            $attr['port'] = $config["port"];
71
+        if (isset($config[ "port" ]))
72
+            $attr[ 'port' ] = $config[ "port" ];
73 73
 
74 74
         self::parseDsn($dsn, $attr);
75 75
         return $dsn;
@@ -81,13 +81,12 @@  discard block
 block discarded – undo
81 81
 
82 82
         $attr = [
83 83
             'driver' => 'oci',
84
-            'dbname' => $config['server'] ?
85
-                '//' . $config['server'] . (isset($config["port"]) ? ':' . $config["port"] : ':1521') . '/' . $config['database'] :
86
-                $config['database']
84
+            'dbname' => $config[ 'server' ] ?
85
+                '//'.$config[ 'server' ].(isset($config[ "port" ]) ? ':'.$config[ "port" ] : ':1521').'/'.$config[ 'database' ] : $config[ 'database' ]
87 86
         ];
88 87
 
89
-        if (isset($config['charset']))
90
-            $attr['charset'] = $config['charset'];
88
+        if (isset($config[ 'charset' ]))
89
+            $attr[ 'charset' ] = $config[ 'charset' ];
91 90
 
92 91
         self::parseDsn($dsn, $attr);
93 92
         return $dsn;
@@ -100,19 +99,19 @@  discard block
 block discarded – undo
100 99
         if (strstr(PHP_OS, 'WIN')) {
101 100
             $attr = [
102 101
                 'driver' => 'sqlsrv',
103
-                'server' => $config['server'],
104
-                'database' => $config['database']
102
+                'server' => $config[ 'server' ],
103
+                'database' => $config[ 'database' ]
105 104
             ];
106 105
         } else {
107 106
             $attr = [
108 107
                 'driver' => 'dblib',
109
-                'host' => $config['host'],
110
-                'dbname' => $config['database']
108
+                'host' => $config[ 'host' ],
109
+                'dbname' => $config[ 'database' ]
111 110
             ];
112 111
         }
113 112
 
114
-        if (isset($config["port"]))
115
-            $attr['port'] = $config["port"];
113
+        if (isset($config[ "port" ]))
114
+            $attr[ 'port' ] = $config[ "port" ];
116 115
 
117 116
         self::parseDsn($dsn, $attr);
118 117
         return $dsn;
@@ -128,18 +127,18 @@  discard block
 block discarded – undo
128 127
 
129 128
     private static function parseDsn(&$dsn, $attr)
130 129
     {
131
-        $driver = $attr['driver'];
132
-        unset($attr['driver']);
130
+        $driver = $attr[ 'driver' ];
131
+        unset($attr[ 'driver' ]);
133 132
 
134
-        $stack = [];
133
+        $stack = [ ];
135 134
 
136 135
         foreach ($attr as $key => $value) {
137 136
             if (is_int($key))
138
-                $stack[] = $value;
137
+                $stack[ ] = $value;
139 138
             else
140
-                $stack[] = $key . '=' . $value;
139
+                $stack[ ] = $key.'='.$value;
141 140
         }
142 141
 
143
-        $dsn = $driver . ':' . implode($stack, ';');
142
+        $dsn = $driver.':'.implode($stack, ';');
144 143
     }
145 144
 }
Please login to merge, or discard this patch.
Braces   +20 added lines, -14 removed lines patch added patch discarded remove patch
@@ -33,8 +33,9 @@  discard block
 block discarded – undo
33 33
         } else {
34 34
             $attr['host'] = $config['host'];
35 35
 
36
-            if (isset($config["port"]))
37
-                $attr['port'] = $config["port"];
36
+            if (isset($config["port"])) {
37
+                            $attr['port'] = $config["port"];
38
+            }
38 39
         }
39 40
 
40 41
         self::parseDsn($dsn, $attr);
@@ -51,8 +52,9 @@  discard block
 block discarded – undo
51 52
             'dbname' => $config['database']
52 53
         ];
53 54
 
54
-        if (isset($config["port"]))
55
-            $attr['port'] = $config["port"];
55
+        if (isset($config["port"])) {
56
+                    $attr['port'] = $config["port"];
57
+        }
56 58
 
57 59
         self::parseDsn($dsn, $attr);
58 60
         return $dsn;
@@ -68,8 +70,9 @@  discard block
 block discarded – undo
68 70
             'dbname' => $config['database']
69 71
         ];
70 72
 
71
-        if (isset($config["port"]))
72
-            $attr['port'] = $config["port"];
73
+        if (isset($config["port"])) {
74
+                    $attr['port'] = $config["port"];
75
+        }
73 76
 
74 77
         self::parseDsn($dsn, $attr);
75 78
         return $dsn;
@@ -86,8 +89,9 @@  discard block
 block discarded – undo
86 89
                 $config['database']
87 90
         ];
88 91
 
89
-        if (isset($config['charset']))
90
-            $attr['charset'] = $config['charset'];
92
+        if (isset($config['charset'])) {
93
+                    $attr['charset'] = $config['charset'];
94
+        }
91 95
 
92 96
         self::parseDsn($dsn, $attr);
93 97
         return $dsn;
@@ -111,8 +115,9 @@  discard block
 block discarded – undo
111 115
             ];
112 116
         }
113 117
 
114
-        if (isset($config["port"]))
115
-            $attr['port'] = $config["port"];
118
+        if (isset($config["port"])) {
119
+                    $attr['port'] = $config["port"];
120
+        }
116 121
 
117 122
         self::parseDsn($dsn, $attr);
118 123
         return $dsn;
@@ -134,10 +139,11 @@  discard block
 block discarded – undo
134 139
         $stack = [];
135 140
 
136 141
         foreach ($attr as $key => $value) {
137
-            if (is_int($key))
138
-                $stack[] = $value;
139
-            else
140
-                $stack[] = $key . '=' . $value;
142
+            if (is_int($key)) {
143
+                            $stack[] = $value;
144
+            } else {
145
+                            $stack[] = $key . '=' . $value;
146
+            }
141 147
         }
142 148
 
143 149
         $dsn = $driver . ':' . implode($stack, ';');
Please login to merge, or discard this patch.
app/framework/Component/Database/Connection/ConnectionFactory.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
     {
39 39
         $connByConfig = Config::getInstance()->get("connections");
40 40
         try {
41
-            if(sizeof($connByConfig ) == 1 && $name == null) {
41
+            if (sizeof($connByConfig) == 1 && $name == null) {
42 42
                 reset($connByConfig);
43 43
                 $config = $this->parseConfig($connByConfig, key($connByConfig));
44 44
                 $name = key($connByConfig);
@@ -62,15 +62,15 @@  discard block
 block discarded – undo
62 62
      */
63 63
     private function parseConfig(array $config, string $name): array
64 64
     {
65
-        if(isset($config[$name]))
66
-            $connection = $config[$name];
65
+        if (isset($config[ $name ]))
66
+            $connection = $config[ $name ];
67 67
         else
68
-            throw new \Exception("Config " .$name. " doesn't exist.");
68
+            throw new \Exception("Config ".$name." doesn't exist.");
69 69
 
70 70
         // make sure that the default config elements exist to prevent an undefined index warning
71
-        foreach(self::defaultConfigElements as $configElement) {
72
-            if(!array_key_exists($configElement, $connection))
73
-                $connection[$configElement];
71
+        foreach (self::defaultConfigElements as $configElement) {
72
+            if (!array_key_exists($configElement, $connection))
73
+                $connection[ $configElement ];
74 74
         }
75 75
 
76 76
         return $connection;
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     {
88 88
         $Pdo = $this->createPdoInstance($config);
89 89
 
90
-        return $this->createConnection($Pdo, $config['database'], $name, $config);
90
+        return $this->createConnection($Pdo, $config[ 'database' ], $name, $config);
91 91
     }
92 92
 
93 93
     /**
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
     {
99 99
         $dsn = "";
100 100
 
101
-        switch ($config['driver']) {
101
+        switch ($config[ 'driver' ]) {
102 102
             case Driver::MariaDB:
103 103
             case Driver::MySql:
104 104
                 $dsn = Driver::mysql($config);
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
         }
127 127
 
128 128
         try {
129
-            return new PDO($dsn, $config['username'], $config['password']);
129
+            return new PDO($dsn, $config[ 'username' ], $config[ 'password' ]);
130 130
         } catch (PDOException $e) {
131 131
             handle($e);
132 132
         }
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
      * @param array $config
140 140
      * @return Connection
141 141
      */
142
-    private function createConnection(PDO $Pdo, $database = "", string $name = '', array $config = [])
142
+    private function createConnection(PDO $Pdo, $database = "", string $name = '', array $config = [ ])
143 143
     {
144 144
         return new Connection($Pdo, $database, $name, $config);
145 145
     }
Please login to merge, or discard this patch.
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -62,15 +62,17 @@
 block discarded – undo
62 62
      */
63 63
     private function parseConfig(array $config, string $name): array
64 64
     {
65
-        if(isset($config[$name]))
66
-            $connection = $config[$name];
67
-        else
68
-            throw new \Exception("Config " .$name. " doesn't exist.");
65
+        if(isset($config[$name])) {
66
+                    $connection = $config[$name];
67
+        } else {
68
+                    throw new \Exception("Config " .$name. " doesn't exist.");
69
+        }
69 70
 
70 71
         // make sure that the default config elements exist to prevent an undefined index warning
71 72
         foreach(self::defaultConfigElements as $configElement) {
72
-            if(!array_key_exists($configElement, $connection))
73
-                $connection[$configElement];
73
+            if(!array_key_exists($configElement, $connection)) {
74
+                            $connection[$configElement];
75
+            }
74 76
         }
75 77
 
76 78
         return $connection;
Please login to merge, or discard this patch.
app/framework/Component/Database/Connection/Connection.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -50,14 +50,14 @@  discard block
 block discarded – undo
50 50
      *
51 51
      * @var array
52 52
      */
53
-    protected $config = [];
53
+    protected $config = [ ];
54 54
 
55 55
     /**
56 56
      * All of the queries run against the connection.
57 57
      *
58 58
      * @var array
59 59
      */
60
-    protected $queryLog = [];
60
+    protected $queryLog = [ ];
61 61
 
62 62
     /**
63 63
      * Indicates whether queries are being logged.
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
      */
67 67
     protected $loggingQueries = true;
68 68
 
69
-    public function __construct(Pdo $pdo, string $database = '', string $name = '', array $conf = [])
69
+    public function __construct(Pdo $pdo, string $database = '', string $name = '', array $conf = [ ])
70 70
     {
71 71
         $this->pdo  = $pdo;
72 72
         $this->name = $name;
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
      */
97 97
     public function flushQueryLog()
98 98
     {
99
-        $this->queryLog = [];
99
+        $this->queryLog = [ ];
100 100
     }
101 101
 
102 102
     /**
@@ -156,12 +156,12 @@  discard block
 block discarded – undo
156 156
 
157 157
     public function getDriver()
158 158
     {
159
-        return $this->config['driver'];
159
+        return $this->config[ 'driver' ];
160 160
     }
161 161
 
162
-    public function select(string $query, array $bindings = [])
162
+    public function select(string $query, array $bindings = [ ])
163 163
     {
164
-        return $this->run($query, $bindings, function ($me, $query, $bindings) {
164
+        return $this->run($query, $bindings, function($me, $query, $bindings) {
165 165
             // For select statements, we'll simply execute the query and return an array
166 166
             // of the database result set. Each element in the array will be a single
167 167
             // row from the database table, and will either be an array or objects.
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
      * @param  array   $bindings
182 182
      * @return bool
183 183
      */
184
-    public function insert($query, $bindings = [])
184
+    public function insert($query, $bindings = [ ])
185 185
     {
186 186
         return $this->statement($query, $bindings);
187 187
     }
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
      * @param  array   $bindings
194 194
      * @return int
195 195
      */
196
-    public function update($query, $bindings = [])
196
+    public function update($query, $bindings = [ ])
197 197
     {
198 198
         return $this->affectingStatement($query, $bindings);
199 199
     }
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
      * @param  array   $bindings
206 206
      * @return int
207 207
      */
208
-    public function delete($query, $bindings = [])
208
+    public function delete($query, $bindings = [ ])
209 209
     {
210 210
         return $this->affectingStatement($query, $bindings);
211 211
     }
@@ -217,9 +217,9 @@  discard block
 block discarded – undo
217 217
      * @param  array   $bindings
218 218
      * @return bool
219 219
      */
220
-    public function statement($query, $bindings = [])
220
+    public function statement($query, $bindings = [ ])
221 221
     {
222
-        return $this->run($query, $bindings, function ($me, $query, $bindings) {
222
+        return $this->run($query, $bindings, function($me, $query, $bindings) {
223 223
             return $me->pdo->prepare($query)->execute($bindings);
224 224
         });
225 225
     }
@@ -231,9 +231,9 @@  discard block
 block discarded – undo
231 231
      * @param  array   $bindings
232 232
      * @return int
233 233
      */
234
-    public function affectingStatement($query, $bindings = [])
234
+    public function affectingStatement($query, $bindings = [ ])
235 235
     {
236
-        return $this->run($query, $bindings, function ($me, $query, $bindings) {
236
+        return $this->run($query, $bindings, function($me, $query, $bindings) {
237 237
 
238 238
             // For update or delete statements, we want to get the number of rows affected
239 239
             // by the statement and return that back to the developer. We'll first need
@@ -314,12 +314,12 @@  discard block
 block discarded – undo
314 314
     {
315 315
         $this->eventManager()->fire("ff.database.query_execution");
316 316
 
317
-        if($this->loggingQueries) {
318
-            $logEntry['startTime']     = $stopwatchEvent->getStartTime();
319
-            $logEntry['query']         = $query;
320
-            $logEntry['executionTime'] = $stopwatchEvent->getDuration();
317
+        if ($this->loggingQueries) {
318
+            $logEntry[ 'startTime' ]     = $stopwatchEvent->getStartTime();
319
+            $logEntry[ 'query' ]         = $query;
320
+            $logEntry[ 'executionTime' ] = $stopwatchEvent->getDuration();
321 321
 
322
-            $this->queryLog[] = $logEntry;
322
+            $this->queryLog[ ] = $logEntry;
323 323
         }
324 324
     }
325 325
 
@@ -330,12 +330,12 @@  discard block
 block discarded – undo
330 330
      */
331 331
     public function fetch(PDOStatement $statement)
332 332
     {
333
-        $result    = [];
333
+        $result    = [ ];
334 334
         $statement = $statement->fetchAll(PDO::FETCH_ASSOC);
335 335
 
336 336
         foreach ($statement as $key => $value) {
337
-            $result[$key] = new Model($this);
338
-            $result[$key]->fillData($value);
337
+            $result[ $key ] = new Model($this);
338
+            $result[ $key ]->fillData($value);
339 339
         }
340 340
 
341 341
         return $result;
Please login to merge, or discard this patch.
app/framework/Component/Database/Manager.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
     /**
22 22
      * @var array Connection
23 23
      */
24
-    private $connections = [];
24
+    private $connections = [ ];
25 25
 
26 26
     /**
27 27
      * @var string $connectionToUse
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
         $this->ConnectionFactory = new ConnectionFactory();
47 47
 
48 48
         // use default connection
49
-        if($this->connectionToUse == null)
49
+        if ($this->connectionToUse == null)
50 50
             $this->connection();
51 51
             $this->useConnection();
52 52
     }
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
     public function connection(string $name = null): Manager
60 60
     {
61 61
         $connection = $this->ConnectionFactory->make($name);
62
-        $this->connections[$connection->getName()] = $connection;
62
+        $this->connections[ $connection->getName() ] = $connection;
63 63
 
64 64
         return $this;
65 65
     }
@@ -72,14 +72,14 @@  discard block
 block discarded – undo
72 72
      */
73 73
     public function getConnection(string $name = null)
74 74
     {
75
-        if($name == null) {
75
+        if ($name == null) {
76 76
             reset($this->connections);
77
-            $Connection = $this->connections[key($this->connections)];
77
+            $Connection = $this->connections[ key($this->connections) ];
78 78
         } else {
79
-            $Connection = $this->connections[$name];
79
+            $Connection = $this->connections[ $name ];
80 80
         }
81 81
 
82
-        if(isset($Connection)) {
82
+        if (isset($Connection)) {
83 83
             return $Connection;
84 84
         } else {
85 85
             return false;
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
     public function useConnection(string $name = null): Manager
95 95
     {
96 96
         $this->connectionToUse = $this->getConnection($name)->getName();
97
-        $this->QueryBuilder    = new Builder($this->connections[$this->connectionToUse]);
97
+        $this->QueryBuilder    = new Builder($this->connections[ $this->connectionToUse ]);
98 98
 
99 99
         return $this;
100 100
     }
@@ -103,29 +103,29 @@  discard block
 block discarded – undo
103 103
      * @param array $columns
104 104
      * @return Builder
105 105
      */
106
-    public function select($columns = ['*'])
106
+    public function select($columns = [ '*' ])
107 107
     {
108 108
         $this->QueryBuilder->select($columns);
109 109
 
110 110
         return $this->QueryBuilder;
111 111
     }
112 112
 
113
-    public function selectRaw(string $query, array $bindings = [])
113
+    public function selectRaw(string $query, array $bindings = [ ])
114 114
     {
115 115
         return $this->QueryBuilder->selectRaw($query, $bindings);
116 116
     }
117 117
 
118
-    public function insertRaw(string $query, array $bindings = [])
118
+    public function insertRaw(string $query, array $bindings = [ ])
119 119
     {
120 120
         return $this->QueryBuilder->insertRaw($query, $bindings);
121 121
     }
122 122
 
123
-    public function updateRaw(string $query, array $bindings = [])
123
+    public function updateRaw(string $query, array $bindings = [ ])
124 124
     {
125 125
         return $this->QueryBuilder->updateRaw($query, $bindings);
126 126
     }
127 127
 
128
-    public function deleteRaw(string $query, array $bindings = [])
128
+    public function deleteRaw(string $query, array $bindings = [ ])
129 129
     {
130 130
         return $this->QueryBuilder->deleteRaw($query, $bindings);
131 131
     }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -46,8 +46,9 @@
 block discarded – undo
46 46
         $this->ConnectionFactory = new ConnectionFactory();
47 47
 
48 48
         // use default connection
49
-        if($this->connectionToUse == null)
50
-            $this->connection();
49
+        if($this->connectionToUse == null) {
50
+                    $this->connection();
51
+        }
51 52
             $this->useConnection();
52 53
     }
53 54
 
Please login to merge, or discard this patch.
app/framework/Component/Database/Schema/Schema.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@
 block discarded – undo
67 67
 */
68 68
     private static function init(string $connection = null)
69 69
     {
70
-        if(is_null(self::$Medoo))
70
+        if (is_null(self::$Medoo))
71 71
             self::$Medoo = new Medoo($connection);
72 72
     }
73 73
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -67,7 +67,8 @@
 block discarded – undo
67 67
 */
68 68
     private static function init(string $connection = null)
69 69
     {
70
-        if(is_null(self::$Medoo))
71
-            self::$Medoo = new Medoo($connection);
70
+        if(is_null(self::$Medoo)) {
71
+                    self::$Medoo = new Medoo($connection);
72
+        }
72 73
     }
73 74
 }
Please login to merge, or discard this patch.