public function getComponent()
    {
        // Simple cache.
        if (!empty($this->component)) {
            return $this->component;
        }

        $filter = new StatementFilter();
        $parser = new CodeParser();

        $notFound   = 'The plugin must define the $plugin->component in the version.php file.';
        $statements = $parser->parseFile($this->directory.'/version.php');

        try {
            $assign = $filter->findFirstPropertyFetchAssignment($statements, 'plugin', 'component', $notFound);
        } catch (\Exception $e) {
            $assign = $filter->findFirstPropertyFetchAssignment($statements, 'module', 'component', $notFound);
        }

        if (!$assign->expr instanceof String_) {
            throw new \RuntimeException('The $plugin->component must be assigned to a string in the version.php file.');
        }
        $this->component = $assign->expr->value;

        return $this->component;
    }
public function getComponent()
    {
        // Simple cache.
        if (!empty($this->component)) {
            return $this->component;
        }

        $filter = new StatementFilter();
        $parser = new CodeParser();

        $notFound   = 'The plugin must define the $plugin->component in the version.php file.';
        $statements = $parser->parseFile($this->directory.'/version.php');

        try {
            $assign = $filter->findFirstPropertyFetchAssignment($statements, 'plugin', 'component', $notFound);
        } catch (\Exception $e) {
            $assign = $filter->findFirstPropertyFetchAssignment($statements, 'module', 'component', $notFound);
        }

        if (!$assign->expr instanceof String_) {
            throw new \RuntimeException('The $plugin->component must be assigned to a string in the version.php file.');
        }
        $this->component = $assign->expr->value;

        return $this->component;
    }
public function getComponent ( ) { // Simple cache. if ( ! empty ( $ this -> component ) ) { return $ this -> component ; } $ filter = new StatementFilter ( ) ; $ parser = new CodeParser ( ) ; $ notFound = 'The plugin must define the $plugin->component in the version.php file.' ; $ statements = $ parser -> parseFile ( $ this -> directory . '/version.php' ) ; try { $ assign = $ filter -> findFirstPropertyFetchAssignment ( $ statements , 'plugin' , 'component' , $ notFound ) ; } catch ( \ Exception $ e ) { $ assign = $ filter -> findFirstPropertyFetchAssignment ( $ statements , 'module' , 'component' , $ notFound ) ; } if ( ! $ assign -> expr instanceof String_ ) { throw new \ RuntimeException ( 'The $plugin->component must be assigned to a string in the version.php file.' ) ; } $ this -> component = $ assign -> expr -> value ; return $ this -> component ; }
Get a plugin's component name.

@throws \RuntimeException

@return string
Get a plugin s component name .