@@ 108-121 (lines=14) @@ | ||
105 | * |
|
106 | * @return Expr |
|
107 | */ |
|
108 | private function createScalarNodeDefault($value): Expr |
|
109 | { |
|
110 | if (is_int($value)) { |
|
111 | return new StaticCall(new Name('IntNode'), 'create', [new Arg(new LNumber($value))]); |
|
112 | } elseif (is_float($value)) { |
|
113 | return new StaticCall(new Name('FloatNode'), 'create', [new Arg(new DNumber($value))]); |
|
114 | } elseif (is_bool($value)) { |
|
115 | return new StaticCall(new Name('BoolNode'), 'create', [new Arg(new ConstFetch(new Name($value ? 'true' : 'false')))]); |
|
116 | } elseif (null === $value) { |
|
117 | return new StaticCall(new Name('NullNode'), 'create'); |
|
118 | } |
|
119 | ||
120 | return new StaticCall(new Name('StringNode'), 'create', [new Arg(new String_($value))]); |
|
121 | } |
|
122 | ||
123 | /** |
|
124 | * @param string|float|int|bool|null $value |
|
@@ 128-141 (lines=14) @@ | ||
125 | * |
|
126 | * @return Expr |
|
127 | */ |
|
128 | private function createScalarNodeQueryBuilderFactory($value): Expr |
|
129 | { |
|
130 | if (is_int($value)) { |
|
131 | return new MethodCall(new Variable('qb'), 'intNode', [new Arg(new LNumber($value))]); |
|
132 | } elseif (is_float($value)) { |
|
133 | return new MethodCall(new Variable('qb'), 'floatNode', [new Arg(new DNumber($value))]); |
|
134 | } elseif (is_bool($value)) { |
|
135 | return new MethodCall(new Variable('qb'), 'boolNode', [new Arg(new ConstFetch(new Name($value ? 'true' : 'false')))]); |
|
136 | } elseif (null === $value) { |
|
137 | return new MethodCall(new Variable('qb'), 'nullNode'); |
|
138 | } |
|
139 | ||
140 | return new MethodCall(new Variable('qb'), 'stringNode', [new Arg(new String_($value))]); |
|
141 | } |
|
142 | ||
143 | /** |
|
144 | * @param array $data |