Completed
Branch master (254118)
by Alexander
01:40
created
src/Route.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
      * @param Closure|null $cb
33 33
      * @param array $parameters
34 34
      */
35
-    public function __construct(string $url, ?Closure $cb = null, array $parameters = [])
35
+    public function __construct(string $url, ? Closure $cb = null, array $parameters = [])
36 36
     {
37 37
         $this->url = $url;
38 38
         $this->callback = $cb;
Please login to merge, or discard this patch.
src/data/Source.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 
9 9
     public function query($query, array $params = []);
10 10
 
11
-    public function one(string $table, array $conditions, array $options = []):?array;
11
+    public function one(string $table, array $conditions, array $options = []): ? array;
12 12
 
13 13
     public function find(string $table, array $conditions, array $options = []);
14 14
 
Please login to merge, or discard this patch.
src/data/MongoDB.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
         throw new \Exception("Query method is not implemented for MongDB");
79 79
     }
80 80
 
81
-    public function one(string $collection_name, array $conditions, array $options = []): ?array
81
+    public function one(string $collection_name, array $conditions, array $options = []): ? array
82 82
     {
83 83
         $collection = $this->collection($collection_name);
84 84
         $conditions = $this->idReplaceConditions($conditions);
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
         return $result->getModifiedCount();
130 130
     }
131 131
 
132
-    public function insert(string $collection, array $data, array $options = []): ?ObjectID
132
+    public function insert(string $collection, array $data, array $options = []): ? ObjectID
133 133
     {
134 134
         $collection = $this->collection($collection);
135 135
         $result = $collection->insertOne($data, $options);
Please login to merge, or discard this patch.
src/data/Mysql.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
         return $result->fetchAll(PDO::FETCH_ASSOC);
62 62
     }
63 63
 
64
-    public function one(string $table, array $conditions, array $options = []): ?array
64
+    public function one(string $table, array $conditions, array $options = []): ? array
65 65
     {
66 66
         $result = $this->find($table, $conditions, $options);
67 67
         $result = iterator_to_array($result);
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
         if (empty($conditions)) {
124 124
             return "";
125 125
         }
126
-        $fun = function ($o, $v) {
126
+        $fun = function($o, $v) {
127 127
             return "{$o}{$v} = :c_{$v}";
128 128
         };
129 129
         $where = array_reduce(array_keys($conditions), $fun, "");
@@ -170,13 +170,13 @@  discard block
 block discarded – undo
170 170
 
171 171
     private function data(array $data): string
172 172
     {
173
-        $fun = function ($o, $v) {
173
+        $fun = function($o, $v) {
174 174
             return "{$o}{$v} = :d_{$v}";
175 175
         };
176 176
         return array_reduce(array_keys($data), $fun, "");
177 177
     }
178 178
 
179
-    public function insert(string $table, array $data, array $options = []): ?int
179
+    public function insert(string $table, array $data, array $options = []): ? int
180 180
     {
181 181
         $keys = implode(', ', array_keys($data));
182 182
         $data_phs = ':d_' . implode(', :d_', array_keys($data));
Please login to merge, or discard this patch.
src/Router.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -62,12 +62,12 @@  discard block
 block discarded – undo
62 62
         }
63 63
 
64 64
         // TODO cache of valid static routes, maybe with a try, catch, finally?
65
-        return new Route($url, function (Request $request) {
65
+        return new Route($url, function(Request $request) {
66 66
             return response\Page::fromRequest($request);
67 67
         });
68 68
     }
69 69
 
70
-    private static function matchDynamicRoute(string $url, string $method = Request::GET): ?Route
70
+    private static function matchDynamicRoute(string $url, string $method = Request::GET): ? Route
71 71
     {
72 72
         foreach (static::$routes[$method] as $route => $cb) {
73 73
             if ($route[0] !== substr($route, -1) || $route[0] !== static::$DELIMITER) {
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 
81 81
             $parameters = array_filter(
82 82
                 $matches,
83
-                function ($v) {
83
+                function($v) {
84 84
                     return !is_int($v);
85 85
                 },
86 86
                 ARRAY_FILTER_USE_KEY
Please login to merge, or discard this patch.
src/bootstrap.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
     if (Environment::get('debug')) {
60 60
         header("Content-type: text/html");
61 61
         echo '<h1 style="color:red;">' . $message . '</h1>';
62
-        echo '<h3>' . $file. ' :: ' . $line . '</h3>';
62
+        echo '<h3>' . $file . ' :: ' . $line . '</h3>';
63 63
         d($meta);
64 64
         die();
65 65
     } else {
Please login to merge, or discard this patch.
src/Connections.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
      * @param Closure|null $close an optional anonymous function that takes the connection as arguments and closes it
30 30
      * @throws InvalidArgumentException if connection $name already exists
31 31
      */
32
-    public static function add(string $name, Closure $open, ?Closure $close = null): void
32
+    public static function add(string $name, Closure $open, ? Closure $close = null) : void
33 33
     {
34 34
         if (isset(self::$open[$name])) {
35 35
             throw new InvalidArgumentException("Connection $name already exists");
Please login to merge, or discard this patch.
src/Model.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
         unset($options['with']);
79 79
         $result = static::db()->find(static::table(), $conditions, $options);
80 80
         $pk = static::pk();
81
-        $gen = function () use ($result, $pk, $with) {
81
+        $gen = function() use ($result, $pk, $with) {
82 82
             foreach ($result as $row) {
83 83
                 $model = new static($row);
84 84
                 if ($with) {
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
         return iterator_to_array($generator);
103 103
     }
104 104
 
105
-    private static function fields(): ?array
105
+    private static function fields(): ? array
106 106
     {
107 107
         return isset(static::$fields) ? static::$fields : null;
108 108
     }
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
         if ($fields) {
114 114
             $data = array_filter(
115 115
                 $data,
116
-                function ($key) use ($fields) {
116
+                function($key) use ($fields) {
117 117
                     return in_array($key, $fields);
118 118
                 },
119 119
                 ARRAY_FILTER_USE_KEY
Please login to merge, or discard this patch.
src/Request.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
         $this->route = Router::match($this->url, $this->method);
63 63
     }
64 64
 
65
-    public function getHeader(string $name): ?string
65
+    public function getHeader(string $name): ? string
66 66
     {
67 67
         return $this->headers[$name] ?? null;
68 68
     }
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
      * @param string $key Dot notation for deeper values, i.e. `user.email`
173 173
      * @return mixed/null
174 174
      */
175
-    public function session(?string $key = null)
175
+    public function session(? string $key = null)
176 176
     {
177 177
         if (session_status() != PHP_SESSION_ACTIVE) {
178 178
             session_start();
Please login to merge, or discard this patch.