Improved and fixed ContentMethod::normalizePathElements

`$object` and `$method` did not exists, causing errors when the method didn't return a correct value.

I also updated the if statement, so it can handle both strings and object which can be used as a string.

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | yes
| BC breaks?    | yes
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -