@@ -24,7 +24,6 @@ |
||
24 | 24 | use PhpBoot\DB\DB; |
25 | 25 | use PhpBoot\DI\DIContainerBuilder; |
26 | 26 | use PhpBoot\DI\Traits\EnableDIAnnotations; |
27 | -use PhpBoot\Lock\LocalAutoLock; |
|
28 | 27 | use PhpBoot\Utils\Logger; |
29 | 28 | use Psr\Container\ContainerExceptionInterface; |
30 | 29 | use Psr\Container\ContainerInterface; |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $default += [ |
88 | 88 | Cache::class => \DI\object(ApcCache::class) |
89 | 89 | ]; |
90 | - }else{ |
|
90 | + } else{ |
|
91 | 91 | $default += [ |
92 | 92 | Cache::class => \DI\object(FilesystemCache::class) |
93 | 93 | ->constructorParameter('directory', sys_get_temp_dir()) |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | } |
271 | 271 | return $next($request); |
272 | 272 | |
273 | - }elseif ($res[0] == Dispatcher::NOT_FOUND) { |
|
273 | + } elseif ($res[0] == Dispatcher::NOT_FOUND) { |
|
274 | 274 | \PhpBoot\abort(new NotFoundHttpException(), [$request->getMethod(), $uri]); |
275 | 275 | } elseif ($res[0] == Dispatcher::METHOD_NOT_ALLOWED) { |
276 | 276 | \PhpBoot\abort(new MethodNotAllowedHttpException($res[1]), [$request->getMethod(), $uri]); |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | } |
295 | 295 | return $response; |
296 | 296 | |
297 | - }catch (\Exception $e){ |
|
297 | + } catch (\Exception $e){ |
|
298 | 298 | $renderer->render($e); |
299 | 299 | } |
300 | 300 |
@@ -5,7 +5,6 @@ |
||
5 | 5 | use DI\FactoryInterface; |
6 | 6 | use \DI\InvokerInterface as DIInvokerInterface; |
7 | 7 | use Doctrine\Common\Cache\Cache; |
8 | -use PhpBoot\Cache\LocalCacheInterface; |
|
9 | 8 | use PhpBoot\Controller\Annotations\BindAnnotationHandler; |
10 | 9 | use PhpBoot\Controller\Annotations\ClassAnnotationHandler; |
11 | 10 | use PhpBoot\Controller\Annotations\HookAnnotationHandler; |
@@ -45,7 +45,7 @@ |
||
45 | 45 | { |
46 | 46 | if($annotations){ |
47 | 47 | parent::__construct($annotations, $cache); |
48 | - }else{ |
|
48 | + } else{ |
|
49 | 49 | parent::__construct(self::$DEFAULT_ANNOTATIONS, $cache); |
50 | 50 | } |
51 | 51 |
@@ -21,7 +21,6 @@ |
||
21 | 21 | use PhpBoot\Metas\ParamMeta; |
22 | 22 | use PhpBoot\Metas\ReturnMeta; |
23 | 23 | use PhpBoot\Utils\ArrayHelper; |
24 | -use PhpBoot\Validator\Validator; |
|
25 | 24 | use Symfony\Component\HttpKernel\Exception\HttpException; |
26 | 25 | |
27 | 26 | class Swagger extends SwaggerObject |
@@ -208,9 +208,9 @@ discard block |
||
208 | 208 | { |
209 | 209 | if ($content instanceof ReturnMeta || $content instanceof ParamMeta) { |
210 | 210 | return $this->makeExample($content->container); |
211 | - }elseif ($content instanceof TypeContainerInterface){ |
|
211 | + } elseif ($content instanceof TypeContainerInterface){ |
|
212 | 212 | return $content->makeExample(); |
213 | - }elseif(is_array($content)) { |
|
213 | + } elseif(is_array($content)) { |
|
214 | 214 | $res = []; |
215 | 215 | foreach ($content as $k => $v) { |
216 | 216 | $res[$k] = $this->makeExample($v); |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | } elseif($container == null){ |
409 | 409 | $schema = null ;//new PrimitiveSchemaObject(); |
410 | 410 | //$schema->type = null; |
411 | - }else { |
|
411 | + } else { |
|
412 | 412 | $schema = new PrimitiveSchemaObject(); |
413 | 413 | //$schema->type = 'mixed'; |
414 | 414 | } |
@@ -2,7 +2,6 @@ |
||
2 | 2 | |
3 | 3 | namespace PhpBoot\ORM; |
4 | 4 | |
5 | -use DI\Container; |
|
6 | 5 | use DI\FactoryInterface; |
7 | 6 | use Doctrine\Common\Cache\Cache; |
8 | 7 | use PhpBoot\DI\DIContainerBuilder; |
@@ -13,7 +13,7 @@ |
||
13 | 13 | if(SafeFileWriter::write($tmpFile, json_encode(['time'=>time(), 'ttl'=>$ttl]), false)){ |
14 | 14 | $this->locked = true; |
15 | 15 | return true; |
16 | - }else{ |
|
16 | + } else{ |
|
17 | 17 | return false; |
18 | 18 | } |
19 | 19 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | $key = 'lock:'.$key; |
13 | 13 | if(function_exists('apc_add')){ |
14 | 14 | $lock = new ApcLock(); |
15 | - }else{ |
|
15 | + } else{ |
|
16 | 16 | $lock = new FileLock(); |
17 | 17 | } |
18 | 18 | try{ |
@@ -29,18 +29,18 @@ discard block |
||
29 | 29 | } |
30 | 30 | //嵌套加锁 |
31 | 31 | self::$currentLock[$key]++; |
32 | - }catch (\Exception $e){ |
|
32 | + } catch (\Exception $e){ |
|
33 | 33 | return $error($e); |
34 | 34 | } |
35 | 35 | $res = null; |
36 | 36 | try{ |
37 | 37 | $res = $success(); |
38 | - }catch (\Exception $e){ |
|
38 | + } catch (\Exception $e){ |
|
39 | 39 | self::$currentLock[$key]--; |
40 | 40 | if(self::$currentLock[$key] == 0){ |
41 | 41 | try{ |
42 | 42 | $lock->unlock($key); |
43 | - }catch (\Exception $e){ |
|
43 | + } catch (\Exception $e){ |
|
44 | 44 | |
45 | 45 | } |
46 | 46 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | if(self::$currentLock[$key] == 0){ |
51 | 51 | try{ |
52 | 52 | $lock->unlock($key); |
53 | - }catch (\Exception $e){ |
|
53 | + } catch (\Exception $e){ |
|
54 | 54 | |
55 | 55 | } |
56 | 56 | } |
@@ -9,7 +9,7 @@ |
||
9 | 9 | if(apc_add($key, 1, $ttl)){ |
10 | 10 | $this->locked = true; |
11 | 11 | return true; |
12 | - }else{ |
|
12 | + } else{ |
|
13 | 13 | return false; |
14 | 14 | } |
15 | 15 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | || $p->container instanceof ArrayContainer){ |
29 | 29 | if(!$var){ |
30 | 30 | $var = []; |
31 | - }elseif(is_string($var)){ |
|
31 | + } elseif(is_string($var)){ |
|
32 | 32 | $var = json_decode($var, true); |
33 | 33 | !json_last_error() or \PhpBoot\abort(new \InvalidArgumentException(__METHOD__.' failed while json_decode with '.json_last_error_msg())); |
34 | 34 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | if($p->validation){ |
40 | 40 | if(is_array($p->validation)){ |
41 | 41 | $vld->rule($p->validation[0], $p->name.'.'.$p->validation[1]); |
42 | - }else{ |
|
42 | + } else{ |
|
43 | 43 | $vld->rule($p->validation, $p->name); |
44 | 44 | } |
45 | 45 | } |
@@ -75,10 +75,10 @@ discard block |
||
75 | 75 | foreach ($this->properties as $p){ |
76 | 76 | if($p->isOptional){ |
77 | 77 | $obj->{$p->name} = $p->default; |
78 | - }elseif($p->container){ |
|
78 | + } elseif($p->container){ |
|
79 | 79 | $var = $p->container->makeExample(); |
80 | 80 | $obj->{$p->name} = $var; |
81 | - }else{ |
|
81 | + } else{ |
|
82 | 82 | $obj->{$p->name} = null; |
83 | 83 | } |
84 | 84 |
@@ -36,7 +36,7 @@ |
||
36 | 36 | { |
37 | 37 | if($annotations){ |
38 | 38 | parent::__construct($annotations, $cache); |
39 | - }else{ |
|
39 | + } else{ |
|
40 | 40 | parent::__construct(self::$DEFAULT_ANNOTATIONS, $cache); |
41 | 41 | } |
42 | 42 | $this->factory = $factory; |