@@ -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; |
@@ -13,15 +13,15 @@ |
||
| 13 | 13 | $getter = function($type)use($builder){ |
| 14 | 14 | if(!$type || $type == 'mixed'){ |
| 15 | 15 | return new MixedTypeContainer(); |
| 16 | - }elseif (TypeHint::isScalarType($type)){ |
|
| 16 | + } elseif (TypeHint::isScalarType($type)){ |
|
| 17 | 17 | return new ScalarTypeContainer($type); |
| 18 | - }else{ |
|
| 18 | + } else{ |
|
| 19 | 19 | return $builder->build($type); |
| 20 | 20 | } |
| 21 | 21 | }; |
| 22 | 22 | if(TypeHint::isArray($type)){ |
| 23 | 23 | $container = ArrayContainer::create($type, $getter); |
| 24 | - }else{ |
|
| 24 | + } else{ |
|
| 25 | 25 | $container = $getter($type); |
| 26 | 26 | } |
| 27 | 27 | return $container; |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | $property or \PhpBoot\abort($container->getClassName()." property $target not exist "); |
| 27 | 27 | if($params->count()>1){ |
| 28 | 28 | $property->validation = [$params->getParam(0), $params->getParam(1)]; |
| 29 | - }else{ |
|
| 29 | + } else{ |
|
| 30 | 30 | $property->validation = $params->getParam(0); |
| 31 | 31 | if($property->validation){ |
| 32 | 32 | $v = new Validator(); |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - }else{ |
|
| 40 | + } else{ |
|
| 41 | 41 | \PhpBoot\abort(new AnnotationSyntaxException( |
| 42 | 42 | "The annotation \"@{$ann->name} {$ann->description}\" of {$container->getClassName()}::{$ann->parent->name} require 1 param, 0 given" |
| 43 | 43 | )); |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | // TODO 防止递归死循环 |
| 38 | 38 | $property->container = ContainerFactory::create($builder, $property->type); |
| 39 | 39 | } |
| 40 | - }else{ |
|
| 40 | + } else{ |
|
| 41 | 41 | \PhpBoot\abort(new AnnotationSyntaxException( |
| 42 | 42 | "The annotation \"@{$ann->name} {$ann->description}\" of {$container->getClassName()}::{$ann->parent->name} require 1 param, 0 given" |
| 43 | 43 | )); |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | $context = $this->loader->build($name); |
| 27 | 27 | /**@var $context ObjectDefinitionContext */ |
| 28 | 28 | $definition = $context->definition; |
| 29 | - }else{ |
|
| 29 | + } else{ |
|
| 30 | 30 | $definition = new ObjectDefinition($name); |
| 31 | 31 | } |
| 32 | 32 | |