Skip to content

Instantly share code, notes, and snippets.

@xiris
Last active January 28, 2016 22:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xiris/afefeb8f5d15be8ca858 to your computer and use it in GitHub Desktop.
Save xiris/afefeb8f5d15be8ca858 to your computer and use it in GitHub Desktop.
Example how to DONT code
<?php
/**
* class bbablabla ....
* ...
* ..
*
*/
public function init(
$arg_user_id,
$arg_client_id
) {
$return = array();
if(
empty($arg_user_id) ||
empty($arg_client_id)
){
//Error Block: invalid input to delete client
include_once CORE_PATH . '/Debug/Error.php';
$error = Error::init(200005);
$return['errors'][] = $error;
return $return;
}
//update client info
include_once DAL_MYSQLI_PATH . '/Clients/DeleteClientDal.php';
$objDeleteClientDal = new DeleteClientDal();
$deleted = $objDeleteClientDal->delete(
$arg_user_id,
$arg_client_id
);
if(!$deleted){
//Error Block: Failed to delete user's client
include_once CORE_PATH . '/Debug/Error.php';
$error = Error::init(200006);
$return['errors'][] = $error;
return $return;
}
$return['clients'] = array();
return $return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment