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