Calling a class extension within the parent class?

1

I work with a kind of HTML rendering framework and events, among other essential things, which is actually a standard HTML source generator because I can use either as a direct renderer or as an add-on to standardize my HTML.

Within this framework I have a class to include the dependencies so that it works correctly, and I can extend this class to include other dependencies that are not part of the framework.

Currently, the way it works is a 'throw it back and forth again', that would be, I store the whole page in a variable, and through the DOM I add the new dependencies giving a merge between arrays default of the framework and the extension extension.

//Dentro de $page está todo html da página
$page = $VIDB->content($form)->container('fluid')->go('pt-br');

echo \geralComponents\extendsLocal__jsPackages::get_extendeds_packages($page);

get_extends_packages () method

public static function get_extendeds_packages($page)
    {
        $extra_packages = self::plus_packages();
        include 'vendor/vidb/assets/php/phpQuery-onefile.php';
        $doc = \phpQuery::newDocument($page);
        $packages = self::get_packages($extra_packages);
        return $doc->find('#js-packages-content')->html($packages);
    }

And the get_packages method

public static function get_packages($extra)
    {
        $files = '';
        $packages = self::packages();
        if($extra != null){
            $packages = array_merge($packages,$extra);
        }
        foreach ($packages as $import)
        {
            $path = $import['path'];
            $file = $import['file'];
            $version = $import['version'];
            $files .= '<script src="' . $path . '/' . $file . '' . $version . '.js"></script>';
        }
        return $files;
    }

Knowing that it may be necessary to include dependencies that are not foreseen in the framework, I could create an extension for the class within the application that is being developed to include this dependency. The question I have about this process is this:

  

It is possible to have a method of the parent class check if there exists   an extension to the class, and if it exists, execute some method of this   class extension?

    
asked by anonymous 23.08.2017 / 15:13

0 answers