@@ -68,15 +68,28 @@ public function providePath(RouteStack $routeStack)
68
68
}
69
69
70
70
$ pathElements = $ object ->$ method ();
71
-
72
- $ pathElements = $ this ->normalizePathElements ($ pathElements , get_class ($ object ).':: ' .$ method );
71
+ $ pathElements = $ this ->normalizePathElements ($ pathElements , $ object );
73
72
74
73
75
74
// @todo: Validate the validator service.
76
75
$ routeStack ->addPathElements ($ pathElements );
77
76
}
78
77
79
- protected function normalizePathElements ($ pathElements , $ methodAsString )
78
+ /**
79
+ * Normalize the given $pathElements variable to an array of path elements,
80
+ * accepting either an array or a string.
81
+ *
82
+ * A string will be converted to an array of elements delimiteed by the
83
+ * path separator.
84
+ *
85
+ * If slugify is enabled, each path element will be slugified.
86
+ *
87
+ * @param mixed $pathElements Either an array or a string
88
+ * @param object $object Used in the case of an exception
89
+ *
90
+ * @return array
91
+ */
92
+ protected function normalizePathElements ($ pathElements , $ object )
80
93
{
81
94
if (is_string ($ pathElements ) || (is_object ($ pathElements ) && method_exists ($ pathElements , '__toString ' ))) {
82
95
if (substr ($ pathElements , 0 , 1 ) == '/ ' ) {
@@ -88,8 +101,9 @@ protected function normalizePathElements($pathElements, $methodAsString)
88
101
89
102
if (!is_array ($ pathElements )) {
90
103
throw new \RuntimeException (sprintf (
91
- 'FromObjectMethodProvider wants %s to return an array of route names or a string, got "%s" ' ,
92
- $ methodAsString ,
104
+ 'FromObjectMethodProvider wants %s::%s to return an array of route names or a string, got "%s" ' ,
105
+ get_class ($ object ),
106
+ $ this ->method ,
93
107
gettype ($ pathElements )
94
108
));
95
109
}
0 commit comments