@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * @param string $label |
101 | 101 | * @return void |
102 | 102 | */ |
103 | - public static function setConnection(string $label=null) |
|
103 | + public static function setConnection(string $label = null) |
|
104 | 104 | { |
105 | 105 | if ($label === null && static::$currentConnection === null) { |
106 | 106 | static::$currentConnection = static::getDefaultLabel(); |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | * @uses static::$Timezone |
134 | 134 | * @uses PDO |
135 | 135 | */ |
136 | - public static function getConnection($label=null) |
|
136 | + public static function getConnection($label = null) |
|
137 | 137 | { |
138 | 138 | if ($label === null) { |
139 | 139 | if (static::$currentConnection === null) { |
@@ -152,10 +152,10 @@ discard block |
||
152 | 152 | |
153 | 153 | if (isset($config['socket'])) { |
154 | 154 | // socket connection |
155 | - $DSN = 'mysql:unix_socket=' . $config['socket'] . ';dbname=' . $config['database']; |
|
155 | + $DSN = 'mysql:unix_socket='.$config['socket'].';dbname='.$config['database']; |
|
156 | 156 | } else { |
157 | 157 | // tcp connection |
158 | - $DSN = 'mysql:host=' . $config['host'] . ';port=' . $config['port'] .';dbname=' . $config['database']; |
|
158 | + $DSN = 'mysql:host='.$config['host'].';port='.$config['port'].';dbname='.$config['database']; |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | try { |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | { |
187 | 187 | if (is_string($data)) { |
188 | 188 | $data = static::getConnection()->quote($data); |
189 | - $data = substr($data, 1, strlen($data)-2); |
|
189 | + $data = substr($data, 1, strlen($data) - 2); |
|
190 | 190 | return $data; |
191 | 191 | } elseif (is_array($data)) { |
192 | 192 | foreach ($data as $key=>$string) { |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | $error = static::getConnection()->errorInfo(); |
512 | 512 | $message = $error[2]; |
513 | 513 | |
514 | - if (App::$App->Config['environment']=='dev') { |
|
514 | + if (App::$App->Config['environment'] == 'dev') { |
|
515 | 515 | /** @var \Whoops\Handler\PrettyPageHandler */ |
516 | 516 | $Handler = \Divergence\App::$App->whoops->popHandler(); |
517 | 517 | |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | */ |
556 | 556 | protected static function startQueryLog($query) |
557 | 557 | { |
558 | - if (App::$App->Config['environment']!='dev') { |
|
558 | + if (App::$App->Config['environment'] != 'dev') { |
|
559 | 559 | return false; |
560 | 560 | } |
561 | 561 |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | |
77 | 77 | protected static function _prepareOneOne(string $relationship, array $options): array |
78 | 78 | { |
79 | - $options['local'] = $options['local'] ?? $relationship . 'ID'; |
|
79 | + $options['local'] = $options['local'] ?? $relationship.'ID'; |
|
80 | 80 | $options['foreign'] = $options['foreign'] ?? 'ID'; |
81 | 81 | return $options; |
82 | 82 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | protected static function _prepareOneMany(string $classShortName, array $options): array |
85 | 85 | { |
86 | 86 | $options['local'] = $options['local'] ?? 'ID'; |
87 | - $options['foreign'] = $options['foreign'] ?? $classShortName. 'ID'; |
|
87 | + $options['foreign'] = $options['foreign'] ?? $classShortName.'ID'; |
|
88 | 88 | $options['indexField'] = $options['indexField'] ?? false; |
89 | 89 | $options['conditions'] = $options['conditions'] ?? []; |
90 | 90 | $options['conditions'] = is_string($options['conditions']) ? [$options['conditions']] : $options['conditions']; |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | $options['local'] = $options['local'] ?? 'ContextID'; |
106 | 106 | $options['foreign'] = $options['foreign'] ?? 'ID'; |
107 | 107 | $options['classField'] = $options['classField'] ?? 'ContextClass'; |
108 | - $options['allowedClasses'] = $options['allowedClasses'] ?? (!empty(static::$contextClasses)?static::$contextClasses:null); |
|
108 | + $options['allowedClasses'] = $options['allowedClasses'] ?? (!empty(static::$contextClasses) ? static::$contextClasses : null); |
|
109 | 109 | return $options; |
110 | 110 | } |
111 | 111 | |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | throw new Exception('Relationship type many-many option requires a linkClass setting.'); |
119 | 119 | } |
120 | 120 | |
121 | - $options['linkLocal'] = $options['linkLocal'] ?? $classShortName . 'ID'; |
|
121 | + $options['linkLocal'] = $options['linkLocal'] ?? $classShortName.'ID'; |
|
122 | 122 | $options['linkForeign'] = $options['linkForeign'] ?? basename(str_replace('\\', '/', $options['class']::$rootClass)).'ID'; |
123 | 123 | $options['local'] = $options['local'] ?? 'ID'; |
124 | 124 | $options['foreign'] = $options['foreign'] ?? 'ID'; |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | $options['type'] = 'one-one'; |
139 | 139 | } |
140 | 140 | |
141 | - switch($options['type']) { |
|
141 | + switch ($options['type']) { |
|
142 | 142 | case 'one-one': |
143 | 143 | $options = static::_prepareOneOne($relationship, $options); |
144 | 144 | break; |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | $options = static::_prepareContextParent($options); |
153 | 153 | break; |
154 | 154 | case 'many-many': |
155 | - $options = static::_prepareManyMany($classShortName,$options); |
|
155 | + $options = static::_prepareManyMany($classShortName, $options); |
|
156 | 156 | break; |
157 | 157 | } |
158 | 158 |