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()
558530
public function getFirstDescendant($class_name)
    {
        if (!class_exists($class_name) && !interface_exists($class_name)) {
            return null;
        }

        $out = null;

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

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

        if ($out === null) {
            foreach ($this->spanning_columns as $column) {
                if ($column instanceof $class_name) {
                    $out = $column;
                    break;
                }

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

        if ($out === null) {
            foreach ($this->groups as $group) {
                if ($group instanceof $class_name) {
                    $out = $group;
                    break;
                }

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

        if ($out === null) {
            foreach ($this->extra_rows as $row) {
                if ($row instanceof $class_name) {
                    $out = $row;
                    break;
                }

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

        return $out;
    }
735082
public function fetchFirstObj(string $class = null)
    {
        if (!$this->wasExecuted()) {
            $this->exec();
        }

        $data = $this->fetchFirst();

        if ($data === null) {
            return null;
        }

        if ($class == null) {
            $obj = new \stdClass();

            foreach ($data as $field => $value) {
                $obj->$field = $value;
            }

            return $obj;
        } else {
            return new $class($data);
        }
    }
100086
public function getFirstDescendant($class_name)
    {
        if (!class_exists($class_name) && !interface_exists($class_name)) {
            return null;
        }

        $out = null;

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

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

        return $out;
    }
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 '';
	}
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;
  }
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;
                }
            }
        }
    }
1328490
protected function findOrCreateMethod(Class_ $class, $name)
    {
        $foundMethods = array_filter(
            $class->getMethods(),
            function (ClassMethod $method) use ($name) {
                return $name === $method->name;
            }
        );

        $method = reset($foundMethods);

        if (!$method) {
            $class->stmts[] = $method = new ClassMethod($name);
        }

        return $method;
    }
797064
public function getTemplateObject($_type, $_ref = null)
    {
        $stack_name = !is_null($_ref) ? $_ref : $this->getTemplateObjectClassName($_type);

        if (!$this->registry->isEntry($stack_name, 'template_objects')) {
            $this->createNewTemplateObject($_type, $_ref);
        }

        return $this->registry->getEntry($stack_name, 'template_objects');
    }
442227
public function fetchObject($class_name = 'stdClass', array $ctor_args = array()) {
		$obj = $this->fetch(PDO::FETCH_OBJ);
		if($class_name == 'stdClass') {
			$res = $obj;
		}
		else {
			$res = $this->populateObject($obj, $class_name, $ctor_args);
		}

		return $res;
	}
884882
public static function extendsClass($class_name, $mother_name)
    {
        if (is_object($class_name)) {
            $class_name = get_class($class_name);
        }
        if (class_exists($class_name)) {
            return (bool) is_subclass_of($class_name, $mother_name);
        }
        return false;
    }
1116759
public function findReferencesToClassLike($fq_class_name)
    {
        $fq_class_name_lc = strtolower($fq_class_name);
        $locations = $this->file_reference_provider->getClassLocations($fq_class_name_lc);

        if (isset($this->use_referencing_locations[$fq_class_name_lc])) {
            $locations = array_merge($locations, $this->use_referencing_locations[$fq_class_name_lc]);
        }

        return $locations;
    }
821795
public static function GetDefaultPropertyGreedy ($property_name) {
		//開始地点
		$reflection_class = new \ReflectionClass(static::class);
		$reflection_class->getDefaultProperties();
		$current_default_property[] = isset($reflection_class[$property_name]) ? $reflection_class[$property_name] : [];

		while ($reflection_class = $reflection_class->getParentClass()) {
			$reflection_class->getDefaultProperties();
			$current_default_property[] = isset($reflection_class[$property_name]) ? $reflection_class[$property_name] : [];
		}

		return $current_default_property;
	}
734979
public function first(): ?\stdClass
    {
        $pdoStatement = $this->provideStatement();
        $pdoStatement = $this->execute($pdoStatement);
        $row = $pdoStatement->fetch(\PDO::FETCH_OBJ);
        return (!empty($row)) ? $row : null;
    }
317641
public function getFirstDescendantNode(...$classNames) {
        foreach ($this->getDescendantNodes() as $descendant) {
            foreach ($classNames as $className) {
                if ($descendant instanceof $className) {
                    return $descendant;
                }
            }
        }
        return null;
    }
574736
protected static function _GetSeesionClassLayerPath ($name = [], $class_path = null) {
		$classes_layer_path = [
			'fw2',
			'classes',
			$class_path ?: static::class
		];
		return array_merge($classes_layer_path, Arrays::AdjustArray($name));
	}
439977
public static function loadController($class_name)
    {
        foreach (self::$class_folders as $f) {
            $f = rtrim($f, '/');
            $filename = $f . '/' . $class_name . '.php';
            if (file_exists($filename)) {
                require_once $filename;
                if (class_exists($class_name)) {
                    return true;
                } else {
                    throw new TaskManagerException('file found but class ' . $class_name . ' not loaded');
                }
            }
        }

        throw new TaskManagerException('class ' . $class_name . ' not found');
    }
234237
public function getFirst()
    {
        if (count($this->children)) {
            reset($this->children);
            return current($this->children);
        } else {
            return null;
        }
    }