Beispiel #1
0
 private function getSubviews($array)
 {
     $views = array();
     foreach ($array as $element) {
         if (is_component($element)) {
             $views[] = $element;
         } elseif (is_array($element)) {
             $views = array_merge($views, $this->getSubviews($element));
         }
     }
     return $views;
 }
Beispiel #2
0
/**
 * Check if $component is compatible with the Component interface, otherwise report notices.
 *
 * @param Component $component
 *
 * @return bool
 */
function is_valid_component(&$component = '__UNDEFINED__')
{
    if (is_component($component)) {
        return true;
    }
    if (is_object($component)) {
        notice(get_class($component) . ' is not an component', get_class($component) . ' doesn\'t implement a render() method');
    } elseif ($component == '__UNDEFINED__') {
        notice('Variable is undefined');
    } else {
        notice('Invalid datatype: "' . gettype($component) . '", expecting a Component object');
    }
    return false;
}