src/Services/PluginManager.php
private function publishServices($register)
    {
        if (!file_exists($this->path . '/boot/services.php')) {
            return;
        }

        // Read enabled packages and add/remove the current plugin.

        $packages = $this->listPackages($register);

        // update manifest

        $dest = '';
        foreach ($packages as $package => $path) {
            $file = base_path($path . '/boot/services.php');
            if (!file_exists($file)) {
                continue;
            }

            // get content
            $src = trim(file_get_contents($file));

            // strip php tag
            if (substr($src, 0, 5) == '<?php') {
                $src = trim(substr($src, 5));
            }
            if (substr($src, -2) == '?>') {
                $src = trim(substr($src, 0, -2));
            }

            // strip the $di variable if exists
            $src = trim(preg_replace('/\$di\s*=\s*\\\\Core\\\\Services\\\\DI::getInstance\(\);/', '', $src));

            // append content to summery file
            if ($dest == '') {
                $dest = PHP_EOL . '$di = \Core\Services\DI::getInstance();' . PHP_EOL;
            }
            $dest .= PHP_EOL .
                '///////////////////////////////////////////////////////////////////////////////' . PHP_EOL .
                '// ' . $package . PHP_EOL .
                PHP_EOL .
                $src . PHP_EOL;
        }

        $this->saveContent($this->getManifest('services'), '<?php' . PHP_EOL . $dest);
    }
private function publishServices($register)
    {
        if (!file_exists($this->path . '/boot/services.php')) {
            return;
        }

        // Read enabled packages and add/remove the current plugin.

        $packages = $this->listPackages($register);

        // update manifest

        $dest = '';
        foreach ($packages as $package => $path) {
            $file = base_path($path . '/boot/services.php');
            if (!file_exists($file)) {
                continue;
            }

            // get content
            $src = trim(file_get_contents($file));

            // strip php tag
            if (substr($src, 0, 5) == '<?php') {
                $src = trim(substr($src, 5));
            }
            if (substr($src, -2) == '?>') {
                $src = trim(substr($src, 0, -2));
            }

            // strip the $di variable if exists
            $src = trim(preg_replace('/\$di\s*=\s*\\\\Core\\\\Services\\\\DI::getInstance\(\);/', '', $src));

            // append content to summery file
            if ($dest == '') {
                $dest = PHP_EOL . '$di = \Core\Services\DI::getInstance();' . PHP_EOL;
            }
            $dest .= PHP_EOL .
                '///////////////////////////////////////////////////////////////////////////////' . PHP_EOL .
                '// ' . $package . PHP_EOL .
                PHP_EOL .
                $src . PHP_EOL;
        }

        $this->saveContent($this->getManifest('services'), '<?php' . PHP_EOL . $dest);
    }
private function publishServices ( $ register ) { if ( ! file_exists ( $ this -> path . '/boot/services.php' ) ) { return ; } // Read enabled packages and add/remove the current plugin. $ packages = $ this -> listPackages ( $ register ) ; // update manifest $ dest = '' ; foreach ( $ packages as $ package => $ path ) { $ file = base_path ( $ path . '/boot/services.php' ) ; if ( ! file_exists ( $ file ) ) { continue ; } // get content $ src = trim ( file_get_contents ( $ file ) ) ; // strip php tag if ( substr ( $ src , 0 , 5 ) == '<?php' ) { $ src = trim ( substr ( $ src , 5 ) ) ; } if ( substr ( $ src , - 2 ) == '?>' ) { $ src = trim ( substr ( $ src , 0 , - 2 ) ) ; } // strip the $di variable if exists $ src = trim ( preg_replace ( '/\$di\s*=\s*\\\\Core\\\\Services\\\\DI::getInstance\(\);/' , '' , $ src ) ) ; // append content to summery file if ( $ dest == '' ) { $ dest = PHP_EOL . '$di = \Core\Services\DI::getInstance();' . PHP_EOL ; } $ dest .= PHP_EOL . '///////////////////////////////////////////////////////////////////////////////' . PHP_EOL . '// ' . $ package . PHP_EOL . PHP_EOL . $ src . PHP_EOL ; } $ this -> saveContent ( $ this -> getManifest ( 'services' ) , '<?php' . PHP_EOL . $ dest ) ; }
Update manifest "services.php"

@param bool $register
Update manifest services . php