Get a component
@param string $component
@return mixed
@throws Server500
347638
final protected function get(string $component)
    {
        switch ($component) {
            case 'request':
                return (FrameworkCore::getRuntimeParameters())->request;
                break;
            case 'query':
                return (FrameworkCore::getRuntimeParameters())->query;
                break;
            case 'session':
                return (HttpSession::getInstance());
                break;
            case 'service':
                return (Services::getInstance());
                break;
            case 'locale':
                return (FEnv::get("app.locale.context"));
                break;
            default:
                throw new Server500(new \ArrayObject(array("explain" =>
                   "Cannot call component : Undefined component $component",
                   "solution" => "Call availables components")));
                break;
        }
    }
441028
protected function marshall(QtiComponent $component)
    {
        $element = static::getDOMCradle()->createElement($component->getQtiClassName());

        $this->setDOMElementAttribute($element, 'identifier', $component->getIdentifier());

        return $element;
    }
448068
protected function _getVersion($component)
    {
        if (!isset(self::$_versions[$component]))
        {
            try
            {
                if ($component === 'koowa') {
                    $version = Koowa::VERSION;
                }
                else $version = $this->getObject('com://admin/' . $component.'.version')->getVersion();
            }
            catch (Exception $e) {
                $version = null;
            }

            self::$_versions[$component] = $version;
        }

        return self::$_versions[$component];
    }
570954
public function reset_component( $component )
    {
        $component->value = $component->default;
        $this->final_instance[$component->name] = $component->default;
        return $this->final_instance;
    }
1178514
private static function padRgbaComponent($component)
    {
        $result = \dechex($component);

        if (2 > \strlen($result)) {
            $result = '0' . $result;
        }

        return $result;
    }
452155
public static function get_component_directory($component) {
        global $CFG;

        list($type, $plugin) = self::normalize_component($component);

        if ($type === 'core') {
            if ($plugin === null) {
                return $path = $CFG->libdir;
            }
            return self::get_subsystem_directory($plugin);
        }

        return self::get_plugin_directory($type, $plugin);
    }
851175
@SuppressWarnings("unchecked")
    public <T> T get(final Contextual<T> component) {
        assertActive();
        return (T) getComponentInstanceMap().get(component);
    }
518274
public function getTranslator($component)
    {
        if (isset($this->locale)) {
            $domain = str_replace('\\', '_', ltrim($component, '\\'));
            $localedir = static::getBaseDir($component);
            return \Erebot\Intl\GettextFactory::translation($domain, $localedir, array($this->locale));
        }

        if ($this->proxified === $this) {
            throw new \Erebot\NotFoundException('No translator associated');
        }

        return $this->proxified->getTranslator($component);
    }
914968
public function get($instanceName) {
		if (!isset($this->objectInstances[$instanceName]) || $this->objectInstances[$instanceName] == null) {
			$this->instantiateComponent($instanceName);
		}
		return $this->objectInstances[$instanceName];
	}
890315
public function get($component, $vhost = null, $name = null)
    {
        if ($vhost && $name) {
            return $this->client->send(sprintf('/api/parameters/%s/%s/%s', urlencode($component), urlencode($vhost), urlencode($name)));
        } elseif ($vhost) {
            return $this->client->send(sprintf('/api/parameters/%s/%s', urlencode($component), urlencode($vhost)));
        } else {
            return $this->client->send(sprintf('/api/parameters/%s', urlencode($component)));
        }
    }
289900
public static function getComponentPropertyValues($component)
    {
        $result = [];

        $result['oc.alias'] = $component->alias;

        $properties = $component->defineProperties();
        foreach ($properties as $name => $params) {
            $result[$name] = $component->property($name);
        }

        return json_encode($result);
    }
156855
public function get_component( $name )
    {
        if(!array_key_exists($name, $this->components))
        {
            throw new \RuntimeException("Composite sub-component not found with name $name");
        }
        return $this->components[$name];
    }
993622
protected static function get(string $component, bool $forInstance = false)
    {
        //读取具体组件
        $component = strtoupper($component);
        if (array_key_exists($component, self::$lists)) {
            $Class = self::$lists[$component][0];
            if ($forInstance) {
                if (!is_object($Class)) {
                    $Class = new $Class;
                }
            } else {
                if (is_object($Class)) {
                    $Class = get_class($Class);
                }
            }
            return $Class;
        }
        throw new Exception("$component does not exist!"); //没有注册则抛出异常
    }
96625
public function injectDependency($component)
    {
        $nullFilter = function($var) {
            return $var === null;
        };
        $members = array_keys(array_filter(get_object_vars($component), $nullFilter));
        $names = array_keys($this->components);
        $members = array_intersect($members, $names);
        foreach ($members as $key) {
            $component->$key = $this->get($key);
        }
    }
852098
public function find($name)
    {
        foreach ($this->all() as $component) {
            if ($component->getLowerName() === strtolower($name)) {
                return $component;
            }
        }

        return;
    }
990715
public function getComponentInstallDirectory($component)
    {
        list($type, $name) = $this->normalizeComponent($component);

        // Must use reflection to avoid using static cache.
        $method = new \ReflectionMethod('core_component', 'fetch_plugintypes');
        $method->setAccessible(true);
        $result = $method->invoke(null);

        if (!array_key_exists($type, $result[0])) {
            throw new \InvalidArgumentException(sprintf('The component %s has an unknown plugin type of %s', $component, $type));
        }

        return $result[0][$type].'/'.$name;
    }
566126
public function getComponent($component)
    {
        if (isset($this->_components[$component])) {
            return self::createComponents($this->_components[$component]);
        } else {
            throw new \Exception($component . '组件不存在');
        }
    }