private function publishAssets($register)
    {
        $build = $this->path . '/assets/build.php';
        if (!file_exists($build)) {
            return;
        }

        if (!$register) {
            DI::getInstance()->get('asset-manager')->remove(null, $this->plugin);
        }

        // update manifest
        $manifest = $this->getManifest('assets');
        /** @noinspection PhpIncludeInspection */
        $list = file_exists($manifest) ? include $manifest : [];
        if ($register) {
            // make absolute path to relative path
            $basePath = base_path();
            $basePathLength = strlen($basePath);
            /** @noinspection PhpIncludeInspection */
            $assets = include $build;
            foreach ($assets as $asset => $sources) {
                foreach ($sources as $i => $source) {
                    if (substr($source, 0, $basePathLength) == $basePath) {
                        $assets[$asset][$i] = substr($source, $basePathLength + 1);
                    }
                }
            }
            // insert asset build information
            /** @noinspection PhpIncludeInspection */
            $list[$this->plugin] = $assets;
        }
        else {
            // remove asset build information
            unset($list[$this->plugin]);
        }
        $this->saveArray($manifest, $list);

        if ($register) {
            DI::getInstance()->get('asset-manager')->publish(null, true, $this->plugin);
        }
    }