Check whether subdef exists before perform get on it

This commit is contained in:
Benoît Burnichon
2016-02-17 12:41:06 +01:00
parent c1b9d74cfc
commit 90b4ad596c
2 changed files with 31 additions and 9 deletions

View File

@@ -129,6 +129,24 @@ class databox_subdefsStructure implements IteratorAggregate, Countable
$this->AvSubdefs = $avSubdefs;
}
/**
* @param string $subdef_type
* @param string $subdef_name
*
* @return bool
*/
public function hasSubdef($subdef_type, $subdef_name)
{
$type = strtolower($subdef_type);
$name = strtolower($subdef_name);
if (isset($this->AvSubdefs[$type][$name])) {
return true;
}
return false;
}
/**
* @param string $subdef_type
* @param string $subdef_name