Method to set property package

@param   AbstractPackage $package

@return  static  Return self to support chaining.
@throws \ReflectionException
175648
public function setPackage(AbstractPackage $package)
    {
        $this->package = $package;

        $this->config['package.name'] = $package->getName();
        $this->config['package.path'] = $package->getDir();

        return $this;
    }
599239
public function processPackage(PackageInterface $package)
    {
        $extra = $package->getExtra();
        $files = isset($extra[self::EXTRA_OPTION_NAME]) ? $extra[self::EXTRA_OPTION_NAME] : null;
        if ($package->getType() !== self::PACKAGE_TYPE && is_null($files)) {
            return;
        }

        $extension = [
            'name'    => $package->getName(),
            'version' => $package->getVersion(),
        ];
        if ($package->getVersion() === '9999999-dev') {
            $reference = $package->getSourceReference() ?: $package->getDistReference();
            if ($reference) {
                $extension['reference'] = $reference;
            }
        }
        $this->data['extensions'][$package->getName()] = $extension;

        $aliases = array_merge(
            $this->prepareAliases($package, 'psr-0'),
            $this->prepareAliases($package, 'psr-4')
        );
        $this->data['aliases'] = array_merge($this->data['aliases'], $aliases);
        foreach ((array) $files as $name => $path) {
            $config = $this->readExtensionConfig($package, $path);
            $config['aliases'] = array_merge(
                $aliases,
                isset($config['aliases']) ? (array) $config['aliases'] : []
            );
            $this->data['aliases'] = array_merge($this->data['aliases'], $config['aliases']);
            $this->data[$name] = isset($this->data[$name]) ? Helper::mergeConfig($this->data[$name], $config) : $config;
        }
    }
839947
protected function installAssets(PackageInterface $package)
    {
        $assets = $this->getPackageAssetsDir($package);
        if (!$assets) {
            return;
        }

        $from = $this->getPackageBasePath($package) . '/' . $assets;
        $target = $this->getAssetsInstallPath($package);
        if (file_exists($from)) {
            $this->io->write(
                sprintf('  - Installing <info>%s</info> assets to <info>%s</info>',
                    $package->getPrettyName(),
                    str_replace(dirname($this->assets_dir) . '/', '', $target)
                )
            );
            $this->filesystem->copy($from, $target);
            Dispatch::registerPackage($package, $target, $this);
            $this->io->write('');
        } else {
            Error::thrower(
                sprintf('Unable to find assets in package "%s"', $package->getPrettyName()),
                '\InvalidArgumentException', __CLASS__, __METHOD__, __LINE__
            );
        }
    }
1235836
private function loadPackageRuleSet(Package $package)
    {
        $ruleSet = new RuleSet();
        $key = $package->generatePackageKey();

        if ($this->cache->has($key)) {
            $ruleSet = $this->cache->getCachedRuleSet($key);
        } elseif (is_dir($path = $package->getPackagePath(self::PACKAGE_PATH))) {
            $ruleSet = $this->traverser->traverse($path);
            $this->cache->cacheRuleSet($key, $ruleSet);
        } else {
            // there is no vendor package in the given path
        }

        return $ruleSet;
    }
1211591
protected function require(string $package): InstallerContract
    {
        $this->task(
            'Require package via composer',
            function () use ($package) {
                return $this->composer->require($package);
            }
        );

        return $this;
    }
1058886
public function unlockPackage(PackageInterface $package)
    {
        $name = $package->getPrettyName();
        $lock = 'extra/tenside/version-locks/' . $this->escape($name);

        // Nothing to do?
        if (!$this->has($lock)) {
            return $this;
        }

        if (false === ($constraint = $this->get($lock))) {
            $this->remove($lock);
            $this->requirePackage($name, null);
            $this->cleanEmptyArraysInPath('extra/tenside');

            return $this;
        }

        $this->requirePackage($name, $constraint);
        $this->remove($lock);
        $this->cleanEmptyArraysInPath('extra/tenside');

        return $this;
    }
116
public function getPattern(PackageInterface $package)
    {
        if (isset($this->packages[$package->getName()])) {
            return $this->packages[$package->getName()];
        } elseif (isset($this->packages[$package->getPrettyName()])) {
            return $this->packages[$package->getPrettyName()];
        } elseif (isset($this->types[$package->getType()])) {
            return $this->types[$package->getType()];
        }
    }
608745
public static function registerPackage(PackageInterface $package, $target, AssetsInstallerInterface $installer = null)
    {
        self::$__autoloader->registerPackage($package, $target, $installer);
    }
951003
public function registerPackage(string $package, string $pattern): self
    {
        return $this->packageResolver->getPackage($package)
            ->registerRoutes($this, $pattern);
    }
181938
public function setPackages(array $packages) {
		$this->resetPackages();
		
		foreach ($packages as $package) {
			$this->appendPackage($package);
		}
		
		return $this;
	}
559820
public function updatePackage(PackageInterface $package, InstallerInterface $installer)
    {
        if (!$this->isPackageInstalled($package)) {
            throw new RuntimeException(sprintf('Package %s is not installed.', $package->getName()));
        }
        if (is_null($package->getRequiredVersion())) {
            $decode = $this->config->getBowerFileContent();
            if (empty($decode['dependencies']) || empty($decode['dependencies'][$package->getName()])) {
                throw new InvalidArgumentException(sprintf('Package %s not found in bower.json', $package->getName()));
            }
            $package->setRequiredVersion($decode['dependencies'][$package->getName()]);
        }

        $bower = $this->config->getPackageBowerFileContent($package);
        $package->setInfo($bower);
        $package->setVersion($bower['version']);
        $package->setRequires(isset($bower['dependencies']) ? $bower['dependencies'] : null);

        $packageTag = $this->getPackageTag($package);
        $this->output->writelnInfoPackage($package, 'validate', sprintf('%s against %s#%s', $packageTag, $package->getName(), $package->getRequiredVersion()));

        $package->setRepository($this->repository);
        if ($packageTag == $package->getVersion()) {
            // if version is fully matching, there's no need to update
            return;
        }
        $package->setVersion($packageTag);

        $this->cachePackage($package);

        $this->output->writelnUpdatingPackage($package);
        $installer->update($package);

        $overrides = $this->config->getOverrideFor($package->getName());
        if (array_key_exists('dependencies', $overrides)) {
            $dependencies = $overrides['dependencies'];
        } else {
            $dependencies = $package->getRequires();
        }
        if (!empty($dependencies)) {
            foreach ($dependencies as $name => $requiredVersion) {
                $depPackage = new Package($name, $requiredVersion);
                if (!$this->isPackageInstalled($depPackage)) {
                    $this->installPackage($depPackage, $installer, true);
                } elseif ($this->isNeedUpdate($depPackage)) {
                    $this->updatePackage($depPackage, $installer);
                }
            }
        }
    }
12702
protected function setPatchedPackageData(PackageInterface $package, array $patchesAppliedData)
    {
        $extra = $package->getExtra();
        $extra['patches_applied'] = $patchesAppliedData;
        $package->setExtra($extra);
        $this->composer->getRepositoryManager()->getLocalRepository()->write();
    }
100122
public function setTask($package, $controller)
    {
        if (!$package instanceof AbstractPackage) {
            $package = $this->getPackage($package);
        }

        $this->setCurrentPackage($package);
        $this->server->setRequest($this->request->withAttribute('_controller', $controller));

        return $this;
    }
205634
public function addPackage($alias, $package)
    {
        $container = $this->getContainer();

        if (is_string($package)) {
            if (!class_exists($package)) {
                return null;
            }

            /** @var \Windwalker\Core\Package\AbstractPackage $package */
            $package = $this->container->newInstance($package);
        }

        if (!$package) {
            return null;
        }

        // If we set custom name to package, use this as alias.
        if (!is_numeric($alias)) {
            $package->setName($alias);
        }

        // Get package identify name.
        $name = $package->getName();

        // Set container and init it
        $subContainer = $container->createChild($name);

        $package->setContainer($subContainer)->boot();

        /** @var WindwalkerApplicationInterface $application */
        $application = $container->get('application');

        // If in Console mode, register commands.
        if ($application->isConsole()) {
            $package->registerCommands($application);
        }

        $container->share('package.' . $name, $package);
        $this->packages[$name] = $package;

        $subContainer->alias('package', 'package.' . $name);

        // Add alias map
        $this->aliases[get_class($package)] = $name;

        return $package;
    }
890536
protected function loadInits(PackageInterface $package)
    {
        if (!$package->getInits()) {
            return $this;
        }

        $initLoader = \Parable\DI\Container::create(\Parable\Framework\Loader\InitLoader::class);
        $initLoader->load($package->getInits());
        return $this;
    }
264686
public function setNodeB($package)
    {
        $this->set('nodeB', $package);
        $this->set('endDate', clone $this->startDate);
        $this->endDate->addSeconds($package->duration);

        return $this;
    }
475554
protected function guessConfigurator(PackageInterface $package)
    {
        $extra = $package->getExtra();
        if (isset($extra['assets-config-class'])) {
            Config::load($extra['assets-config-class'], true);
        }
//        Config::overload($extra);
        return $this;
    }