@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | return $this->idTokenIssuer; |
| 258 | 258 | } |
| 259 | 259 | |
| 260 | - public function check(array $response = []){ |
|
| 260 | + public function check(array $response = []) { |
|
| 261 | 261 | return true; |
| 262 | 262 | } |
| 263 | 263 | |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | */ |
| 274 | 274 | protected function createAccessToken(array $response, AbstractGrant $grant) |
| 275 | 275 | { |
| 276 | - if($this->check($response)){ |
|
| 276 | + if ($this->check($response)) { |
|
| 277 | 277 | return new AccessToken($response); |
| 278 | 278 | } |
| 279 | 279 | return null; |
@@ -95,10 +95,10 @@ |
||
| 95 | 95 | |
| 96 | 96 | public function strip_descr($body, $fallback = null, $type = null, $lengthIn = 300) |
| 97 | 97 | { |
| 98 | - if($type && $fallback){ |
|
| 98 | + if ($type && $fallback) { |
|
| 99 | 99 | $length = isset($fallback[$type]) ? $fallback[$type] : null; |
| 100 | 100 | } |
| 101 | - if(!isset($length)){ |
|
| 101 | + if (!isset($length)) { |
|
| 102 | 102 | $length = $lengthIn; |
| 103 | 103 | } |
| 104 | 104 | |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | public function trans($id, array $parameters = array(), $domain = null, $locale = null) |
| 41 | 41 | { |
| 42 | 42 | $request = Request::createFromGlobals(); |
| 43 | - if (1||$request->get('sludio_debug') === 'text') { |
|
| 43 | + if (1 || $request->get('sludio_debug') === 'text') { |
|
| 44 | 44 | return $domain.'.'.$id; |
| 45 | 45 | } |
| 46 | 46 | |
@@ -43,8 +43,8 @@ discard block |
||
| 43 | 43 | $application = new Application($kernel); |
| 44 | 44 | $application->setAutoExit(false); |
| 45 | 45 | $input = new ArrayInput(array( |
| 46 | - 'command' => 'cache:'.$command, |
|
| 47 | - '--env' => $kernel->getEnvironment(), |
|
| 46 | + 'command' => 'cache:'.$command, |
|
| 47 | + '--env' => $kernel->getEnvironment(), |
|
| 48 | 48 | )); |
| 49 | 49 | $application->run($input); |
| 50 | 50 | $data['success'] = 1; |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | $application->setAutoExit(false); |
| 67 | 67 | |
| 68 | 68 | $input = new ArrayInput(array( |
| 69 | - 'command' => 'ibrows:sonatatranslationbundle:clearcache' |
|
| 69 | + 'command' => 'ibrows:sonatatranslationbundle:clearcache' |
|
| 70 | 70 | )); |
| 71 | 71 | $application->run($input); |
| 72 | 72 | $data['success'] = 1; |
@@ -16,13 +16,13 @@ discard block |
||
| 16 | 16 | $data['success'] = 1; |
| 17 | 17 | |
| 18 | 18 | $clients = []; |
| 19 | - foreach($this->container->getServiceIds() as $id){ |
|
| 20 | - if(substr($id, 0, 9) === 'snc_redis' && $this->container->get($id) instanceof Client){ |
|
| 19 | + foreach ($this->container->getServiceIds() as $id) { |
|
| 20 | + if (substr($id, 0, 9) === 'snc_redis' && $this->container->get($id) instanceof Client) { |
|
| 21 | 21 | $clients[] = $id; |
| 22 | 22 | } |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - foreach($clients as $snc){ |
|
| 25 | + foreach ($clients as $snc) { |
|
| 26 | 26 | $this->container->get($snc)->flushdb(); |
| 27 | 27 | } |
| 28 | 28 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | )); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - public function ibrowsAction(Request $request){ |
|
| 58 | + public function ibrowsAction(Request $request) { |
|
| 59 | 59 | global $kernel; |
| 60 | 60 | |
| 61 | 61 | if ('AppCache' === get_class($kernel)) { |
@@ -26,13 +26,13 @@ |
||
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | $clients = []; |
| 29 | - foreach($kernel->getContainer()->getServiceIds() as $id){ |
|
| 30 | - if(substr($id, 0, 9) === 'snc_redis' && $kernel->getContainer()->get($id) instanceof Client){ |
|
| 29 | + foreach ($kernel->getContainer()->getServiceIds() as $id) { |
|
| 30 | + if (substr($id, 0, 9) === 'snc_redis' && $kernel->getContainer()->get($id) instanceof Client) { |
|
| 31 | 31 | $clients[] = $id; |
| 32 | 32 | } |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - foreach($clients as $snc){ |
|
| 35 | + foreach ($clients as $snc) { |
|
| 36 | 36 | $kernel->getContainer()->get($snc)->flushdb(); |
| 37 | 37 | } |
| 38 | 38 | |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | self::$em = self::$container->get('doctrine')->getManager($manager); |
| 26 | 26 | self::$connection = self::$em->getConnection(); |
| 27 | 27 | |
| 28 | - if(!$no_fk_check) { |
|
| 28 | + if (!$no_fk_check) { |
|
| 29 | 29 | $sth = self::$connection->prepare('SET FOREIGN_KEY_CHECKS = 0'); |
| 30 | 30 | $sth->execute(); |
| 31 | 31 | } |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | public static function close($no_fk_check = false) |
| 35 | 35 | { |
| 36 | - if(!$no_fk_check) { |
|
| 36 | + if (!$no_fk_check) { |
|
| 37 | 37 | $sth = self::$connection->prepare('SET FOREIGN_KEY_CHECKS = 1'); |
| 38 | 38 | $sth->execute(); |
| 39 | 39 | } |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | public static function persist($object, $full = false, $extraFields = [], $no_fk_check = false, $manager = null, &$out = null) |
| 78 | 78 | { |
| 79 | 79 | self::init($no_fk_check, $manager); |
| 80 | - if(is_object($object)){ |
|
| 80 | + if (is_object($object)) { |
|
| 81 | 81 | self::extract($object); |
| 82 | 82 | $tableName = self::$tableName; |
| 83 | 83 | } else { |
@@ -88,13 +88,13 @@ discard block |
||
| 88 | 88 | $values = []; |
| 89 | 89 | |
| 90 | 90 | $columns = self::$mock[$tableName]; |
| 91 | - if(!empty($extraFields) && isset($extraFields[$tableName])) { |
|
| 91 | + if (!empty($extraFields) && isset($extraFields[$tableName])) { |
|
| 92 | 92 | $columns = array_merge(self::$mock[$tableName], $extraFields[$tableName]); |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | foreach ($columns as $value => $key) { |
| 96 | 96 | $variable = null; |
| 97 | - if(!is_array($key) && !is_array($value)) { |
|
| 97 | + if (!is_array($key) && !is_array($value)) { |
|
| 98 | 98 | if ($object->{'get'.ucfirst($value)}() instanceof \DateTime) { |
| 99 | 99 | $variable = "'".addslashes(trim($object->{'get'.ucfirst($value)}()->format('Y-m-d H:i:s')))."'"; |
| 100 | 100 | } else { |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | $id = null; |
| 135 | 135 | } |
| 136 | 136 | if ($sql && $id) { |
| 137 | - if($out){ |
|
| 137 | + if ($out) { |
|
| 138 | 138 | $out = $sql; |
| 139 | 139 | } |
| 140 | 140 | $sth = self::$connection->prepare($sql); |
@@ -154,11 +154,11 @@ discard block |
||
| 154 | 154 | ]; |
| 155 | 155 | $sql = ''; |
| 156 | 156 | |
| 157 | - foreach($methods as $method){ |
|
| 158 | - if(isset($extra[$method])){ |
|
| 157 | + foreach ($methods as $method) { |
|
| 158 | + if (isset($extra[$method])) { |
|
| 159 | 159 | $sql .= ' '.$method.' '; |
| 160 | - if(is_array($extra[$method])){ |
|
| 161 | - foreach($extra[$method] as $group){ |
|
| 160 | + if (is_array($extra[$method])) { |
|
| 161 | + foreach ($extra[$method] as $group) { |
|
| 162 | 162 | $sql .= $group.' '; |
| 163 | 163 | } |
| 164 | 164 | } else { |
@@ -167,16 +167,16 @@ discard block |
||
| 167 | 167 | } |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | - if(isset($extra['LIMIT'])){ |
|
| 171 | - if(is_array($extra['LIMIT'])){ |
|
| 172 | - if(isset($extra['LIMIT'][1])){ |
|
| 170 | + if (isset($extra['LIMIT'])) { |
|
| 171 | + if (is_array($extra['LIMIT'])) { |
|
| 172 | + if (isset($extra['LIMIT'][1])) { |
|
| 173 | 173 | $offset = $extra['LIMIT'][0]; |
| 174 | 174 | $limit = $extra['LIMIT'][1]; |
| 175 | 175 | } else { |
| 176 | 176 | $offset = 0; |
| 177 | 177 | $limit = $extra['LIMIT'][0]; |
| 178 | 178 | } |
| 179 | - $sql .= 'LIMIT '.$offset.', '.$limit; |
|
| 179 | + $sql .= 'LIMIT '.$offset.', '.$limit; |
|
| 180 | 180 | } |
| 181 | 181 | } |
| 182 | 182 | |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | $skip = false; |
| 193 | 193 | foreach ($where as $key => $value) { |
| 194 | 194 | $fk = $key; |
| 195 | - if(is_array($value)){ |
|
| 195 | + if (is_array($value)) { |
|
| 196 | 196 | $skip = true; |
| 197 | 197 | $f = trim($value[0]); |
| 198 | 198 | } else { |
@@ -200,18 +200,18 @@ discard block |
||
| 200 | 200 | } |
| 201 | 201 | break; |
| 202 | 202 | } |
| 203 | - if(!$skip && isset(self::$mock[$tableName][$fk])) { |
|
| 204 | - if(is_numeric($f)){ |
|
| 203 | + if (!$skip && isset(self::$mock[$tableName][$fk])) { |
|
| 204 | + if (is_numeric($f)) { |
|
| 205 | 205 | $whereSql .= ' WHERE '.self::$mock[$tableName][$fk]." = $f"; |
| 206 | 206 | } else { |
| 207 | 207 | $whereSql .= ' WHERE '.self::$mock[$tableName][$fk]." = '".addslashes(trim($f))."'"; |
| 208 | 208 | } |
| 209 | 209 | } else { |
| 210 | - if(!$skip && is_numeric($f)){ |
|
| 210 | + if (!$skip && is_numeric($f)) { |
|
| 211 | 211 | $whereSql .= ' WHERE '.$fk." = $f"; |
| 212 | - } elseif(!$skip && !is_numeric($f)) { |
|
| 212 | + } elseif (!$skip && !is_numeric($f)) { |
|
| 213 | 213 | $whereSql .= ' WHERE '.$fk." = '".addslashes(trim($f))."'"; |
| 214 | - } elseif($skip && is_numeric($fk)){ |
|
| 214 | + } elseif ($skip && is_numeric($fk)) { |
|
| 215 | 215 | $whereSql .= " WHERE $f"; |
| 216 | 216 | } |
| 217 | 217 | } |
@@ -219,18 +219,18 @@ discard block |
||
| 219 | 219 | if ($where && is_array($where)) { |
| 220 | 220 | foreach ($where as $key => $value) { |
| 221 | 221 | $skip = is_array($value); |
| 222 | - if(!$skip && isset(self::$mock[$tableName][$key])) { |
|
| 223 | - if(is_numeric($value)){ |
|
| 222 | + if (!$skip && isset(self::$mock[$tableName][$key])) { |
|
| 223 | + if (is_numeric($value)) { |
|
| 224 | 224 | $whereSql .= ' AND '.self::$mock[$tableName][$key]." = $value"; |
| 225 | 225 | } else { |
| 226 | 226 | $whereSql .= ' AND '.self::$mock[$tableName][$key]." = '".addslashes(trim($value))."'"; |
| 227 | 227 | } |
| 228 | 228 | } else { |
| 229 | - if(!$skip && is_numeric($value)){ |
|
| 229 | + if (!$skip && is_numeric($value)) { |
|
| 230 | 230 | $whereSql .= ' AND '.$key." = $value"; |
| 231 | - } elseif(!$skip && !is_numeric($f)) { |
|
| 231 | + } elseif (!$skip && !is_numeric($f)) { |
|
| 232 | 232 | $whereSql .= ' AND '.$key." = '".addslashes(trim($value))."'"; |
| 233 | - } elseif($skip && is_numeric($key)){ |
|
| 233 | + } elseif ($skip && is_numeric($key)) { |
|
| 234 | 234 | $whereSql .= " AND {$value[0]}"; |
| 235 | 235 | } |
| 236 | 236 | } |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | public static function get($object, $one = false, $where = [], $no_fk_check = true, $fields = [], $manager = null, $extra = [], &$out = null) |
| 245 | 245 | { |
| 246 | 246 | self::init($no_fk_check, $manager); |
| 247 | - if(is_object($object)){ |
|
| 247 | + if (is_object($object)) { |
|
| 248 | 248 | self::extract($object); |
| 249 | 249 | $tableName = self::$tableName; |
| 250 | 250 | } else { |
@@ -252,26 +252,26 @@ discard block |
||
| 252 | 252 | } |
| 253 | 253 | $whereSql = self::buildWhere($tableName, $where); |
| 254 | 254 | $select = (isset($extra['MODE']) ? 'SELECT '.$extra['MODE'] : 'SELECT').' '; |
| 255 | - if(!$fields){ |
|
| 255 | + if (!$fields) { |
|
| 256 | 256 | $sql = $select.'id FROM '.$tableName.' '.$whereSql; |
| 257 | 257 | } else { |
| 258 | 258 | $sql = $select.(implode(', ', $fields)).' FROM '.$tableName.' '.$whereSql; |
| 259 | 259 | } |
| 260 | - if(!empty($extra)){ |
|
| 260 | + if (!empty($extra)) { |
|
| 261 | 261 | $extraSql = self::buildExtra($tableName, $extra); |
| 262 | 262 | $sql .= $extraSql; |
| 263 | 263 | } |
| 264 | - if($out){ |
|
| 264 | + if ($out) { |
|
| 265 | 265 | $out = $sql; |
| 266 | 266 | } |
| 267 | 267 | $sth = self::$connection->prepare($sql); |
| 268 | 268 | $sth->execute(); |
| 269 | 269 | $result = $sth->fetchAll(); |
| 270 | 270 | if ($one && $result) { |
| 271 | - if(!$fields){ |
|
| 271 | + if (!$fields) { |
|
| 272 | 272 | return intval($result[0]['id']); |
| 273 | 273 | } else { |
| 274 | - if(count($fields) === 1){ |
|
| 274 | + if (count($fields) === 1) { |
|
| 275 | 275 | return $result[0][$fields[0]]; |
| 276 | 276 | } else { |
| 277 | 277 | return $result[0]; |
@@ -280,19 +280,19 @@ discard block |
||
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | self::close($no_fk_check); |
| 283 | - if($one || !$result) { |
|
| 283 | + if ($one || !$result) { |
|
| 284 | 284 | return null; |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | $field = null; |
| 288 | - if(!$fields){ |
|
| 288 | + if (!$fields) { |
|
| 289 | 289 | $field = 'id'; |
| 290 | - } elseif(count($fields) === 1 && $fields[0] !== '*'){ |
|
| 290 | + } elseif (count($fields) === 1 && $fields[0] !== '*') { |
|
| 291 | 291 | $field = $fields[0]; |
| 292 | 292 | } |
| 293 | 293 | |
| 294 | - if($field){ |
|
| 295 | - foreach($result as &$res){ |
|
| 294 | + if ($field) { |
|
| 295 | + foreach ($result as &$res) { |
|
| 296 | 296 | $res = $res[$field]; |
| 297 | 297 | } |
| 298 | 298 | } |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | public static function link($object, $data, $no_fk_check = false, $manager = null, &$out = null) |
| 304 | 304 | { |
| 305 | 305 | self::init($no_fk_check, $manager); |
| 306 | - if(is_object($object)){ |
|
| 306 | + if (is_object($object)) { |
|
| 307 | 307 | self::extract($object); |
| 308 | 308 | $tableName = self::$tableName; |
| 309 | 309 | } else { |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | VALUES |
| 323 | 323 | (".implode(',', $values).") |
| 324 | 324 | "; |
| 325 | - if($out){ |
|
| 325 | + if ($out) { |
|
| 326 | 326 | $out = $sql; |
| 327 | 327 | } |
| 328 | 328 | $sth = self::$connection->prepare($sql); |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | public static function update($id, $object, $extra = [], $no_fk_check = false, $manager = null, &$out = null) |
| 336 | 336 | { |
| 337 | 337 | self::init($no_fk_check, $manager); |
| 338 | - if(is_object($object)){ |
|
| 338 | + if (is_object($object)) { |
|
| 339 | 339 | self::extract($object); |
| 340 | 340 | $tableName = self::$tableName; |
| 341 | 341 | } else { |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | $data = []; |
| 360 | 360 | |
| 361 | 361 | $columns = self::$mock[$tableName]; |
| 362 | - if(!empty($extra) && isset($extra[$tableName])) { |
|
| 362 | + if (!empty($extra) && isset($extra[$tableName])) { |
|
| 363 | 363 | $columns = array_merge(self::$mock[$tableName], $extra[$tableName]); |
| 364 | 364 | } |
| 365 | 365 | |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | foreach ($data as $key => $value) { |
| 379 | 379 | $meta = self::$metadata[$tableName]->getFieldMapping($flip[$key]); |
| 380 | 380 | $meta = $meta['type']; |
| 381 | - if(in_array($meta, ['boolean','integer','longint'])){ |
|
| 381 | + if (in_array($meta, ['boolean', 'integer', 'longint'])) { |
|
| 382 | 382 | $value = intval($value); |
| 383 | 383 | } else { |
| 384 | 384 | $value = "'".addslashes(trim($value))."'"; |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | } |
| 388 | 388 | $sqlu = substr($sqlu, 0, -1); |
| 389 | 389 | $sqlu .= " WHERE id = ".$id; |
| 390 | - if($out){ |
|
| 390 | + if ($out) { |
|
| 391 | 391 | $out = $sql; |
| 392 | 392 | } |
| 393 | 393 | $sthu = self::$connection->prepare($sqlu); |
@@ -400,7 +400,7 @@ discard block |
||
| 400 | 400 | public static function delete($object, $where = [], $no_fk_check = false, $manager = null, &$out = null) |
| 401 | 401 | { |
| 402 | 402 | self::init($no_fk_check, $manager); |
| 403 | - if(is_object($object)){ |
|
| 403 | + if (is_object($object)) { |
|
| 404 | 404 | self::extract($object); |
| 405 | 405 | $tableName = self::$tableName; |
| 406 | 406 | } else { |
@@ -408,7 +408,7 @@ discard block |
||
| 408 | 408 | } |
| 409 | 409 | $whereSql = self::buildWhere($tableName, $where); |
| 410 | 410 | $sql = 'DELETE FROM '.$tableName.' '.$whereSql; |
| 411 | - if($out){ |
|
| 411 | + if ($out) { |
|
| 412 | 412 | $out = $sql; |
| 413 | 413 | } |
| 414 | 414 | $sth = self::$connection->prepare($sql); |
@@ -444,7 +444,7 @@ discard block |
||
| 444 | 444 | AND |
| 445 | 445 | table_schema = DATABASE() |
| 446 | 446 | "; |
| 447 | - if($out){ |
|
| 447 | + if ($out) { |
|
| 448 | 448 | $out = $sql; |
| 449 | 449 | } |
| 450 | 450 | $sth = self::$connection->prepare($sql); |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | if ($container->hasParameter('sludio_helper.pagination.behaviour') && !empty($container->getParameter('sludio_helper.pagination.behaviour', []))) { |
| 23 | 23 | $functions = $container->getParameter('sludio_helper.pagination.behaviour'); |
| 24 | 24 | foreach ($functions as $function) { |
| 25 | - if($short_functions){ |
|
| 25 | + if ($short_functions) { |
|
| 26 | 26 | array_push($this->functions, $this->withFunction(array_keys($function)[0], array_values($function)[0])); |
| 27 | 27 | } |
| 28 | 28 | array_push($this->functions, $this->withFunction('sludio_'.array_keys($function)[0], array_values($function)[0])); |
@@ -56,7 +56,7 @@ |
||
| 56 | 56 | public function getResourceOwnerDetailsUrl(AccessToken $token) |
| 57 | 57 | { |
| 58 | 58 | $fields = array_merge($this->defaultUserFields, $this->userFields); |
| 59 | - return 'https://www.googleapis.com/plus/v1/people/me?' . http_build_query([ |
|
| 59 | + return 'https://www.googleapis.com/plus/v1/people/me?'.http_build_query([ |
|
| 60 | 60 | 'fields' => implode(',', $fields), |
| 61 | 61 | 'alt' => 'json', |
| 62 | 62 | ]); |
@@ -37,17 +37,17 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | public function getBaseAuthorizationUrl() |
| 39 | 39 | { |
| 40 | - return $this->domain . $this->authorize; |
|
| 40 | + return $this->domain.$this->authorize; |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | public function getBaseAccessTokenUrl(array $params = []) |
| 44 | 44 | { |
| 45 | - return $this->domain . $this->token . '?client_id='.$this->options['client_id'] . '&client_secret='.$this->options['client_secret']; |
|
| 45 | + return $this->domain.$this->token.'?client_id='.$this->options['client_id'].'&client_secret='.$this->options['client_secret']; |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - public function getTokenData(){ |
|
| 48 | + public function getTokenData() { |
|
| 49 | 49 | $data = array( |
| 50 | - 'url' => $this->domain . $this->token, |
|
| 50 | + 'url' => $this->domain.$this->token, |
|
| 51 | 51 | 'client_id' => $this->options['client_id'], |
| 52 | 52 | 'client_secret' => $this->options['client_secret'] |
| 53 | 53 | ); |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | public function getResourceOwnerDetailsUrl(AccessToken $token) |
| 59 | 59 | { |
| 60 | - return $this->domain . $this->api; |
|
| 60 | + return $this->domain.$this->api; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | protected function getDefaultScopes() |