Gets the first descendant UI-object of a specific class

@param string $class_name class name to look for.

@return SwatUIObject the first descendant UI-object or null if no
matching descendant is found.

@see SwatUIParent::getFirstDescendant()
549924
public function getFirstDescendant($class_name)
    {
        if (!class_exists($class_name) && !interface_exists($class_name)) {
            return null;
        }

        $out = null;

        foreach ($this->getRenderers() as $renderer) {
            if ($renderer instanceof $class_name) {
                $out = $renderer;
                break;
            }

            if ($renderer instanceof SwatUIParent) {
                $out = $renderer->getFirstDescendant($class_name);
                if ($out !== null) {
                    break;
                }
            }
        }

        return $out;
    }
25848
protected function _findClasses($class_names)
    {
        if (!is_array($class_names)) {
            $class_names = array($class_names);
        }
        foreach ($class_names as $_cls) {
            if (true===class_exists($_cls)) {
                return $_cls;
            }
        }
        return false;
    }
1108629
protected function classMatches($class_name, $descendant_of)
	{
		$class_name = ltrim($class_name, '\\');
		$descendant_of = ltrim($descendant_of, '\\');
		$match_with = array_merge(class_implements($class_name), class_parents($class_name));

		return $class_name == $descendant_of || in_array($descendant_of, $match_with);
	}
1163698
public static function Get ($const_name, $default_value = NULL, $undefined_exception = FALSE) {
		$separator_pos = Strings::RearPosition($const_name, '::');
		if ($separator_pos && !class_exists(Strings::Substring($const_name, 0, $separator_pos), TRUE) && $undefined_exception) {
			throw CoreException::RaiseSystemError('存在しないクラスが設定されています。const name:%s', [$const_name]);
		}
		if (!defined($const_name)) {
			if ($undefined_exception) {
				throw CoreException::RaiseSystemError('存在しない定数名が設定されています。const name:%s', [$const_name]);
			}
			return $default_value;
		}
		return constant($const_name);
	}
958505
public Object getFirst(String name) {
    Object value = get(name);
    if (value instanceof Collection<?>) {
      @SuppressWarnings("unchecked")
      Collection<Object> collectionValue = (Collection<Object>) value;
      Iterator<Object> iterator = collectionValue.iterator();
      return iterator.hasNext() ? iterator.next() : null;
    }
    return value;
  }
862708
private function constructor(string $class_name, array $params = null)
    {
        $this->state->category = CompilerState::CATEGORY_CONSTRUCTOR;
        $this->state->name = '';
        $params_str = '';
        if (is_array($params)){
            $params_str = $this->decorateParamsForMethodCall($params);
        }
        return $class_name . '(' . $params_str . ')';
    }
772054
public function getFirst()
    {
        $first = null;

        if (count($this->renderers) > 0) {
            $first = reset($this->renderers);
        }

        return $first;
    }
317641
public function getFirstDescendantNode(...$classNames) {
        foreach ($this->getDescendantNodes() as $descendant) {
            foreach ($classNames as $className) {
                if ($descendant instanceof $className) {
                    return $descendant;
                }
            }
        }
        return null;
    }
1176882
public function getNamespace($class_name)
	{
		$class_name = trim($class_name, '\\');
		if ($last_separator = strrpos($class_name, '\\'))
		{
			return substr($class_name, 0, $last_separator + 1);
		}
		return '';
	}
246968
public function getFirstElementOfType($classnames)
    {
        if (!is_array($classnames)) {
            $classnames = array($classnames);
        }

        foreach (array_keys($this->_data) as $key) {
            $element = $this->getData($key);

            if (!is_object($element)) {
                continue;
            }

            foreach ($classnames as $classname) {
                if (is_a($element, $classname)) {
                    return $element;
                }
            }
        }
    }
715774
protected function _findFirst(string $name)
    {
        $oid = AttributeType::attrNameToOID($name);
        foreach ($this->_attributes as $attr) {
            if ($attr->oid() == $oid) {
                return $attr;
            }
        }
        return null;
    }
476574
public function getInstance(string $class, $element_id)
    {
        if (!is_a($class, Hierarchy::class, true))
            throw new TypeError("Not a subclass of Hierarchy: $class");

        if (is_object($element_id) && get_class($element_id) === $class)
            return $element_id;

        if (!is_scalar($element_id))
            throw new TypeError("Element-ID must be a scalar");

        if (!$this->hasInstance($class, $element_id))
        {
            $root = $class::getRootName();
            if ($element_id === $root)
                $this->hierarchy[$class][$root] = new $class($this, $root);
            else
                throw new Exception("Element-ID '{$element_id}' is unknown for {$class}");
        }

        return $this->hierarchy[$class][$element_id];
    }
17143
private function classGet()
    {
        return isset( $this->class )
            ? $this->class
            : (
                  ( $firstElement = $this->firstElementGet() )
                ? ( $this->class = get_class( $firstElement ) )
                : null
              )
            ;
    }
691818
public function GetClassChilds($class_name, $namespace="")
    {   
        $childs = array();
        
        if(!$namespace)
        {
            $components = $this->GetComponents($class_name);
            
            if($components->HasNamespace())
            {
                $namespace = $components->namespace;
                $class_name = $components->type;
            }
            else
            {
                $namespace = "\\";
            }
        }
        
        $parent_class = "";
        
        if($namespace != "\\")
            $parent_class .= $namespace . "\\" . $class_name;
        else
            $parent_class .= $class_name;
        
        foreach($this->headers as $header_object)
        {
            foreach($header_object->namespaces as $namespace_object)
            {
                foreach($namespace_object->classes as $class_object)
                {
                    if(in_array($parent_class, $class_object->parents))
                    {
                        $childs[$class_object->name] = $class_object;
                        
                        $childs += $this->GetClassChilds(
                            $class_object->name,
                            $class_object->namespace->name
                        );
                    }
                }
            }
        }
        
        return $childs;
    }
396587
public function setNameFirst($name_first){
        if(!$this->setModified('name_first', $name_first)->isModified()) {
            return $this;
        }
        $this->name_first = $name_first;

        return $this;
    }
598395
public function _get($_name)
    {
        $getMethod = 'get' . ucfirst($_name);
        if(method_exists($this,$getMethod))
            return $this->$getMethod();
        else
            return false;
    }
507561
public function setClassName($class_name)
    {
        if ($class_name === null) {
            throw new ENabuCoreException(
                    ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
                    array("\$class_name")
            );
        }

        $implements_list = class_implements($class_name, true);

        if (is_array($implements_list) &&
            array_search('nabu\http\interfaces\INabuHTTPResponseRender', $implements_list)
        ) {
            $this->setValue("nb_http_render_descriptor_class_name", $class_name);
        } else {
            throw new ENabuCoreException(ENabuCoreException::ERROR_INVALID_RENDER_DESCRIPTOR_CLASS);
        }

        return $this;
    }