It depends on the application / definition of the application. But traditionally, your functions are used in places where $ object-> doSomething () does just that. Based on the check there, you prevent the ability to do something () of your OWN acccord, you know?
Also, if you continue checking out, you can easily manage it. There is no need to look for this internal function. Keep it OOP but like it more
$ data = $ validator-> sanitizeSomething ($ data); $ Object-> iNoToSpd ($ data);
this keeps your validation rules separate and easy to maneuver, as well as your internal functions.
To clarify, let's say you have a db object that adds an array to the table:
class db { function addRow($table, $associativeArray) {
Do you want your check to be there?
function addRow($table, $associativeArray) { if( isset( $assiciativeArray['description'] ) {
it would be stupid - you need to have the object in which you work,
class product { function update() { if( $this->validate() ) { $this->db->addRow($this->toArray());
Dan heberden
source share