@@ 221-238 (lines=18) @@ | ||
218 | return $this; |
|
219 | } |
|
220 | ||
221 | protected static function convertToRoutine($values, $type = null, $locale = null) |
|
222 | { |
|
223 | return collect($values)->map( |
|
224 | function ($value) use ($type, $locale) { |
|
225 | if ($value instanceof Routine) { |
|
226 | if (isset($type) && $value->type != $type) { |
|
227 | throw new InvalidArgumentException("Type was set to {$type} but routine is of type {$value->type}"); |
|
228 | } |
|
229 | ||
230 | return $value; |
|
231 | } |
|
232 | ||
233 | $className = static::getRoutineClassName(); |
|
234 | ||
235 | return $className::findFromString($value, $type, $locale); |
|
236 | } |
|
237 | ); |
|
238 | } |
|
239 | ||
240 | protected static function convertToRoutineOfAnyType($values, $locale = null) |
|
241 | { |
@@ 228-245 (lines=18) @@ | ||
225 | return $this; |
|
226 | } |
|
227 | ||
228 | protected static function convertToTask($values, $type = null, $locale = null) |
|
229 | { |
|
230 | return collect($values)->map( |
|
231 | function ($value) use ($type, $locale) { |
|
232 | if ($value instanceof Task) { |
|
233 | if (isset($type) && $value->type != $type) { |
|
234 | throw new InvalidArgumentException("Type was set to {$type} but task is of type {$value->type}"); |
|
235 | } |
|
236 | ||
237 | return $value; |
|
238 | } |
|
239 | ||
240 | $className = static::getTaskClassName(); |
|
241 | ||
242 | return $className::findFromString($value, $type, $locale); |
|
243 | } |
|
244 | ); |
|
245 | } |
|
246 | ||
247 | protected static function convertToTaskOfAnyType($values, $locale = null) |
|
248 | { |