Avoid unused local variables such as '$discover_function'. (Would it be '$discover_func' instead?)
'$object->$attribute' is wrong. '$object->attribute' is correct.
Avoid unused local variables such as '$full_match'.
Avoid unused local variables such as '$v'.