I am fresh at OOP and I am curious if the code below is object oriented and can be improved:
Ok I have improved the code, is it now better? Kind regards Bas
class cTitleBreadcrumb{
//set url params for check
private $_actions = array('insert','view','update','delete');
private $_items = array('imagelist','mkdir','sItem');
public function __construct($sAction, $sItem){
if(isset($sAction) || isset($sItem)){
$this->sAction = $sAction;
$this->sItem = $sItem;
}
}
//display action by checking if action isset
public function displayAction(){
if($this->checkUrlAction($this->sAction) === true){
return $this->sAction;
}
}
//display item by checking if item isset
public function displayItem(){
if($this->checkUrlItem($this->sItem) === true){
return $this->sItem;
}
}
//check if action is in array, see private params
private function checkUrlAction($_actions){
return in_array($_actions, $this->_actions);
}
//check if item is in array, see private params
private function checkUrlItem($_items){
if(in_array($_items, $this->_items)){
return true;
}
elseif($this->checkTables() === true){
return true;
}
}
//check in dbase if tablename exist
private function checkTables(){
$objShowPDO = new mShowPDO();
$result = $objShowPDO->allTables();
while($array = $result->fetch()){
if($array[0] == $this->sItem){
return true;
}
}
}