| 124 | | if (is_string($call[1])) |
|---|
| 125 | | { |
|---|
| 126 | | $arguments = array($this->dumpValue($call[1])); |
|---|
| | 117 | $arguments = array(); |
|---|
| | 118 | foreach ($call[1] as $value) |
|---|
| | 119 | { |
|---|
| | 120 | $arguments[] = $this->dumpValue($value); |
|---|
| | 121 | } |
|---|
| | 122 | |
|---|
| | 123 | $calls .= sprintf(" \$instance->%s(%s);\n", $call[0], implode(', ', $arguments)); |
|---|
| | 124 | } |
|---|
| | 125 | |
|---|
| | 126 | return $calls; |
|---|
| | 127 | } |
|---|
| | 128 | |
|---|
| | 129 | protected function addServiceConfigurator($id, $definition) |
|---|
| | 130 | { |
|---|
| | 131 | if (!$callable = $definition->getConfigurator()) |
|---|
| | 132 | { |
|---|
| | 133 | return ''; |
|---|
| | 134 | } |
|---|
| | 135 | |
|---|
| | 136 | if (is_array($callable)) |
|---|
| | 137 | { |
|---|
| | 138 | if (is_object($callable[0]) && $callable[0] instanceof sfServiceReference) |
|---|
| | 139 | { |
|---|
| | 140 | return sprintf(" %s->%s(\$instance);\n", $this->getServiceCall((string) $callable[0]), $callable[1]); |
|---|
| 130 | | $arguments = array(); |
|---|
| 131 | | foreach ($call[1] as $value) |
|---|
| 132 | | { |
|---|
| 133 | | $arguments[] = $this->dumpValue($value); |
|---|
| 134 | | } |
|---|
| 135 | | } |
|---|
| 136 | | |
|---|
| 137 | | $calls .= sprintf(" \$instance->%s(%s);\n", $call[0], implode(', ', $arguments)); |
|---|
| 138 | | } |
|---|
| 139 | | |
|---|
| 140 | | return $calls; |
|---|
| 141 | | } |
|---|
| 142 | | |
|---|
| 143 | | protected function addServiceConfigurator($id, $definition) |
|---|
| 144 | | { |
|---|
| 145 | | if ($callable = $definition->getConfigurator()) |
|---|
| 146 | | { |
|---|
| 147 | | if (is_array($callable)) |
|---|
| 148 | | { |
|---|
| 149 | | if (is_object($callable[0]) && $callable[0] instanceof sfServiceReference) |
|---|
| 150 | | { |
|---|
| 151 | | return sprintf(" %s->%s(\$instance);\n", $this->getServiceCall((string) $callable[0]), $callable[1]); |
|---|
| 152 | | } |
|---|
| 153 | | else |
|---|
| 154 | | { |
|---|
| 155 | | return sprintf(" call_user_func(array(%s, '%s'), \$instance);\n", $this->dumpValue($callable[0]), $callable[1]); |
|---|
| 156 | | } |
|---|
| 157 | | } |
|---|
| 158 | | else |
|---|
| 159 | | { |
|---|
| 160 | | return sprintf(" %s(\$instance);\n", $callable); |
|---|
| 161 | | } |
|---|
| | 144 | return sprintf(" call_user_func(array(%s, '%s'), \$instance);\n", $this->dumpValue($callable[0]), $callable[1]); |
|---|
| | 145 | } |
|---|
| | 146 | } |
|---|
| | 147 | else |
|---|
| | 148 | { |
|---|
| | 149 | return sprintf(" %s(\$instance);\n", $callable); |
|---|