| 35 | | throw new RuntimeException('T.B.D'); |
| | 35 | foreach($this->names as $name => $pos){ |
| | 36 | if(!isset($parameterValue[$pos])){ |
| | 37 | continue; |
| | 38 | } |
| | 39 | $value = $parameterValue[$pos]; |
| | 40 | if(is_object($value)){ |
| | 41 | // value was dto |
| | 42 | $r = new ReflectionClass($value); |
| | 43 | $props = $r->getProperties(); |
| | 44 | foreach($props as $property){ |
| | 45 | $propertyName = $property->getName(); |
| | 46 | if(false === strpos($expression, $propertyName)){ |
| | 47 | continue; |
| | 48 | } |
| | 49 | $namedValue = self::makeExpression($value->$propertyName); |
| | 50 | $expression = strtr($expression, array($propertyName => $namedValue)); |
| | 51 | if(eval('return ' . $expression . ';')){ |
| | 52 | return $statement; |
| | 53 | } |
| | 54 | } |
| | 55 | } else { |
| | 56 | if(false === strpos($expression, $name)){ |
| | 57 | continue; |
| | 58 | } |
| | 59 | $value = self::makeExpression($value); |
| | 60 | $expression = strtr($expression, array($name => $value)); |
| | 61 | if(eval('return ' . $expression . ';')){ |
| | 62 | return $statement; |
| | 63 | } |
| | 64 | } |
| | 65 | } |
| | 66 | return ''; |
| 39 | | if(strpos($expression, $name) !== false){ |
| 40 | | $value = $parameterValue[$pos]; |
| 41 | | if(is_string($value)){ |
| 42 | | $value = '\'' . $value . '\''; |
| | 70 | if(!isset($parameterValue[$pos])){ |
| | 71 | continue; |
| | 72 | } |
| | 73 | $value = $parameterValue[$pos]; |
| | 74 | if(is_object($value)){ |
| | 75 | // value was dto |
| | 76 | $r = new ReflectionClass($value); |
| | 77 | $props = $r->getProperties(); |
| | 78 | foreach($props as $property){ |
| | 79 | $propertyName = $property->getName(); |
| | 80 | if(false === strpos($expression, $propertyName)){ |
| | 81 | continue; |
| | 82 | } |
| | 83 | $namesValue = self::makeExpression($value->$propertyName); |
| | 84 | |
| | 85 | $expression = strtr($expression, array($propertyName => $namesValue)); |
| | 86 | if(eval('return ' . $expression . ';')){ |
| | 87 | $expression = $statement; |
| | 88 | } |