Defines the structure of this cms package.

@param PackageDefinition $package

@return void
346528
protected function define(PackageDefinition $package)
    {
        $package->name('faqs');

        $package->metadata([
            'icon' => 'question-circle-o',
        ]);

        $package->modules([
            'faqs' => FaqModule::class,
        ]);
    }
1033410
protected function requireMigrations($package)
    {
        $files = $this->container['files'];

        //
        $path = $this->getMigrationPath($package);

        $migrations = $files->glob($path.'*_*.php');

        foreach ($migrations as $migration) {
            $files->requireOnce($migration);
        }
    }
1160181
public function loadPackage($package, $subPackages = [])
    {
        $packageDir = implode(DIRECTORY_SEPARATOR, [
                'packages',
                $package,
            ]) . DIRECTORY_SEPARATOR;

        if (count($subPackages)) {

            if (array_key_exists('libraries', $subPackages)) {
                foreach ($subPackages[ 'libraries' ] as $subPackageFile) {
                    $pluginDir = $packageDir . 'libraries' . DIRECTORY_SEPARATOR;
                    $pluginName = $subPackageFile;

                    if ($this->body->loadFile($pluginDir . $pluginName . DIRECTORY_SEPARATOR . $pluginName . '.js')) {
                        $this->head->loadFile($pluginDir . $pluginName . DIRECTORY_SEPARATOR . $pluginName . '.css');
                    } else {
                        $this->body->loadFile($pluginDir . $pluginName . '.js');
                    }
                }

                unset($subPackages[ 'libraries' ]);
            }

            $this->head->loadFile($packageDir . $package . '.css');
            $this->body->loadFile($packageDir . $package . '.js');

            foreach ($subPackages as $subPackage => $subPackageFiles) {
                if ($subPackage === 'theme' or $subPackage === 'themes') {
                    if (is_string($subPackageFiles)) {
                        $subPackageFiles = [$subPackageFiles];
                    }

                    foreach ($subPackageFiles as $themeName) {
                        $themeDir = $packageDir . 'themes' . DIRECTORY_SEPARATOR;

                        if ($this->head->loadFile($themeDir . $themeName . DIRECTORY_SEPARATOR . $themeName . '.css')) {
                            $this->body->loadFile($themeDir . $themeName . DIRECTORY_SEPARATOR . $themeName . '.js');
                        } else {
                            $this->head->loadFile($themeDir . $themeName . '.css');
                        }
                    }
                } elseif ($subPackage === 'plugins') {
                    foreach ($subPackageFiles as $subPackageFile) {
                        $pluginDir = $packageDir . 'plugins' . DIRECTORY_SEPARATOR;
                        $pluginName = $subPackageFile;

                        $pluginName = str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $pluginName);
                        if (strpos($pluginName, DIRECTORY_SEPARATOR) !== false) {
                            $pluginDir .= pathinfo($pluginName, PATHINFO_DIRNAME) . DIRECTORY_SEPARATOR;
                            $pluginName = pathinfo($pluginName, PATHINFO_BASENAME);
                        }

                        if ($this->body->loadFile($pluginDir . $pluginName . DIRECTORY_SEPARATOR . $pluginName . '.js')) {
                            $this->head->loadFile($pluginDir . $pluginName . DIRECTORY_SEPARATOR . $pluginName . '.css');
                        } else {
                            $this->body->loadFile($pluginDir . $pluginName . '.js');
                        }
                    }
                } elseif ($subPackage === 'libraries') {
                    foreach ($subPackageFiles as $subPackageFile) {
                        $libraryDir = $packageDir . 'libraries' . DIRECTORY_SEPARATOR;
                        $libraryName = $subPackageFile;

                        $libraryName = str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $libraryName);
                        if (strpos($libraryName, DIRECTORY_SEPARATOR) !== false) {
                            $libraryDir .= pathinfo($libraryName, PATHINFO_DIRNAME) . DIRECTORY_SEPARATOR;
                            $libraryName = pathinfo($libraryName, PATHINFO_BASENAME);
                        }

                        if ($this->body->loadFile($libraryDir . $libraryName . DIRECTORY_SEPARATOR . $libraryName . '.js')) {
                            $this->head->loadFile($libraryDir . $libraryName . DIRECTORY_SEPARATOR . $libraryName . '.css');
                        } else {
                            $this->body->loadFile($libraryDir . $libraryName . '.js');
                        }
                    }
                }
            }
        } else {
            $this->head->loadFile($packageDir . $package . '.css');
            $this->body->loadFile($packageDir . $package . '.js');
        }
    }
1370129
public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
    {
        new Textpattern();
        parent::install($repo, $package);
        $plugin = new $this->textpatternPackager($this->getInstallPath($package), $package);
        $plugin->install();
    }
836472
public function syncAssets(AbstractPackage $package)
    {
        $this->out();

        try {
            $this->console->executeByPath('asset sync ' . $package->name, ['hard' => $this->getOption('hard')]);
        } catch (\Exception $e) {
            $this->err($e->getMessage());
        }
    }
87353
public function execute(ProjectDescriptor $project)
    {
        $rootPackageDescriptor = new PackageDescriptor();
        $rootPackageDescriptor->setName('\\');
        $project->getIndexes()->set('packages', new Collection());
        $project->getIndexes()->packages['\\'] = $rootPackageDescriptor;

        foreach ($project->getFiles() as $file) {
            $this->addElementsOfTypeToPackage($project, array($file), 'files');
            $this->addElementsOfTypeToPackage($project, $file->getConstants()->getAll(), 'constants');
            $this->addElementsOfTypeToPackage($project, $file->getFunctions()->getAll(), 'functions');
            $this->addElementsOfTypeToPackage($project, $file->getClasses()->getAll(), 'classes');
            $this->addElementsOfTypeToPackage($project, $file->getInterfaces()->getAll(), 'interfaces');
            $this->addElementsOfTypeToPackage($project, $file->getTraits()->getAll(), 'traits');
        }
    }
702620
public function loadPackages($packages)
    {
        foreach ($packages as $package => $files) {
            if (is_string($files)) {
                $this->loadPackage($files);
            } elseif (is_array($files)) {
                $this->loadPackage($package, $files);
            } elseif (is_object($files)) {
                $this->loadPackage($package, get_object_vars($files));
            }
        }
    }
1105929
protected function publishAssets(string $package): void
    {
        if (! is_null($path = $this->getPath())) {
            $this->assets->publish($package, $path);
        } else {
            $this->assets->publishPackage($package);
        }

        $this->output->writeln('<info>Assets published for package:</info> '.$package);
    }
1074920
public function addPackage($name, AbstractPackage $package)
    {
        $this->container->get('package.resolver')->addPackage($name, $package);

        return $this;
    }
1189841
public function writelnListPackage(PackageInterface $package, Bowerphp $bowerphp)
    {
        $this->output->writeln(sprintf('%s#%s<info>%s</info>',
            $package->getName(),
            $package->getVersion(),
            $bowerphp->isPackageExtraneous($package) ? ' extraneous' : ''
        ));
    }
472013
public function initialize(array $packages)
    {
        $this->registeredClassNames = $this->registerClassFiles($packages);
        $this->reflectionService->buildReflectionData($this->registeredClassNames);

        $rawCustomObjectConfigurations = $this->configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_OBJECTS);

        $configurationBuilder = new ConfigurationBuilder();
        $configurationBuilder->injectReflectionService($this->reflectionService);
        $configurationBuilder->injectLogger($this->logger);

        $this->objectConfigurations = $configurationBuilder->buildObjectConfigurations($this->registeredClassNames, $rawCustomObjectConfigurations);

        $this->setObjects($this->buildObjectsArray());
    }
1008359
private function assignDeclaredLayout($package, $file)
    {
        $file = lcfirst($file);
        if (substr(strtolower($file), -6) == '.phtml') {
            $file = substr($file, 0, -6);
        }

        $package = $this->app->getPackage($package);
        $pathPieces = array($package['package_path'], 'res', 'layout', $file);
        $path = implode(self::DS, $pathPieces) . '.phtml';
        if (file_exists($path)) {
            $this->layoutLocation = $path;
            return true;
        }
        $e = new LayoutFileNotFoundException('Invalid layout file path, expected: "' . $path . '"');
        $e->setAdditionalData('Layout Path Checked: ', $path);
        throw $e;
    }
1218339
public function updateEntry($package)
	{
		$this->verifyCommand($package);

		$lines = file($this->less);

		// Set the new colors
		$lines[0] = '@bg:                ' . $package['bg'] . ";\n";
		$lines[1] = '@gray:              ' . $package['gray'] . ";\n";
		$lines[2] = '@brand-primary:     ' . $package['primary'] . ";\n";
		$lines[3] = '@brand-info:        ' . $package['info'] . ";\n";
		$lines[4] = '@brand-success:     ' . $package['success'] . ";\n";
		$lines[5] = '@brand-warning:     ' . $package['warning'] . ";\n";
		$lines[6] = '@brand-danger:      ' . $package['danger'] . ";\n";
		$lines[7] = '@menuColor:         ' . $package['menu'] . ";\n";

		$this->file->delete($this->less);
		$this->file->put($this->less, implode($lines));
	}
1304814
public function linkDropins(PackageInterface $package)
    {
        $this->filesystem->ensureDirectoryExists($this->getContentPath());

        $content_dir = realpath($this->getContentPath());
        $dropins_dir = realpath($this->getInstallPath($package) . '/dropins/');

        // Link dropins not yet added.
        foreach (new \DirectoryIterator($dropins_dir) as $dropin) {
            if ($dropin->isDot()) {
                continue;
            }

            $src  = $content_dir . '/' . $dropin->getFilename();
            $dest = $dropins_dir . '/' . $dropin->getFilename();

            if (file_exists($src)) {
                $this->io->write('<info>Unlinking ' . $this->filesystem->findShortestPath($src, $dest) . '</info>');
                unlink($src);
            }

            $this->io->write('<info>Linking ' . $this->filesystem->findShortestPath($src, $dest) . '</info>');
            $this->filesystem->relativeSymlink($dest, $src);
        }
    }
848346
protected function injectPackages(ContainerInterface $container)
	{
		foreach ($this->getPackages() as $package) {
			$package->inject($container);
		}
	}
33898
public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
    {
        parent::install($repo, $package);
        $this->generateVendorMetaData();
    }
71648
public function removePackage($package)
    {
        $config = $this->getContent();
        if (isset($config['require'][$package])) {
            unset($config['require'][$package]);
            $this->setContent($config);
        }
    }