Method to get property Package

@param int $backwards

@return AbstractPackage
502328
public function getPackage($backwards = 4)
    {
        if (!$this->package) {
            // Get package name or guess it.
            $name = $this->config['package.name'] ?: MvcHelper::guessPackage(get_called_class(), $backwards);

            // Get package object
            if ($name) {
                $this->package = PackageHelper::getPackage($name);
            }

            // If package not found, use NullPackage instead.
            if (!$this->package) {
                $this->package = new NullPackage();

                $this->package->setName($name);
            }
        }

        return $this->package;
    }
1158686
protected function _getUlangInfo($key = null, $reverse = false) {
		$result = '';
		if (empty($key)) {
			return $result;
		}

		$UIlangs = $this->_modelConfigSettingsApp->getUiLangs();
		if (empty($UIlangs)) {
			return $result;
		}

		if ($reverse) {
			$UIlangs = array_flip($UIlangs);
		}
		if (isset($UIlangs[$key])) {
			$result = $UIlangs[$key];
		}

		return $result;
	}
13653
public function package($dir = null, $copyTo = null)
    {
        if (true === $this->getPhpunitService()->hasSupport()) {
            $this->getPhpunitService()->test($dir);
        }

        $box = $this->getJsonService()->parseFile('box.json');
        $file = $box['output'];

        $this->getFilesystemService()->createDirectory(dirname($file));

        $this->getSystemService()->execute('bin/box build', $dir);

        if (null === $copyTo) {
            return $file;
        }

        $this->getSystemService()->execute($this->_('sudo cp %s %s', $file, $copyTo));

        return $file;
    }
505823
public function getPackages( $keys = null )
    {
        $packages = array();

        if ( empty( $keys ) )
        {
            foreach ( $this as $subPackages )
            {
                $packages = array_merge(
                    $packages,
                    array_values( $subPackages )
                );
            }
        }
        else if ( is_array( $keys ) )
        {
            foreach ( $keys as $key )
            {
                $key = (string) $key;

                if ( ! empty( $this[$key] ) )
                {
                    $packages = array_merge(
                        $packages,
                        array_values( $this[$key] )
                    );
                }
            }
        }
        else
        {
            $packages = $this[(string) $keys];
        }

        return array_unique( array_map( 'strtolower', $packages ) );
    }
64597
@SuppressWarnings("squid:S2259") // potential multi-threading NPE
  public Package getRootPackage() {
    Package aPackage = this;
    while (aPackage.getParent() != null) {
      aPackage = aPackage.getParent();
    }
    return aPackage;
  }
872790
public function setPackage($package)
    {
        if ($package instanceof AbstractPackage) {
            $this->package = $package;
        } else {
            $this->package = PackageHelper::getPackage($package);
        }

        return $this;
    }
732808
public function setPackage($package)
    {
        $this->package = implode('\\', array_map(function ($piece) {
            return Inflector::classify(Inflector::underscore($piece));
        }, explode('.', $package)));
        
        return $this;
    }
1278735
public static function getPackageName($classname)
    {
        $reflect = new ReflectionClass($classname);

        if (method_exists($reflect, 'getNamespaceName')) {
            $namespace = $reflect->getNamespaceName();

            if ($namespace != '') {
                return $namespace;
            }
        }

        if (preg_match('/@package[\s]+([\.\w]+)/', $reflect->getDocComment(), $matches)) {
            return $matches[1];
        }

        return "default";
    }
315149
static function package($package) {
        if(!isset(self::$packages[$package])) {
            self::$packages[$package] = new Package($package);
        }
        
        return self::$packages[$package];
    }
106458
public function getPackageName()
    {
        $reflection = new \ReflectionClass($this);
        $inflector = new Inflector();

        return str_replace('_', '-', $inflector->tableize(str_replace('ServiceProvider', '', $reflection->getShortName())));
    }
1072197
protected function decorateWithPackagistStats(VersionedPackage $package)
    {
        if (null === $this->decorateBaseUrl) {
            return $package;
        }

        $rfs        = new RemoteFilesystem(new BufferIO());
        $requestUrl = sprintf($this->decorateBaseUrl, $package->getName());
        if (!($jsonData = $rfs->getContents($requestUrl, $requestUrl))) {
            $this->decorateBaseUrl = null;
            return $package;
        }
        try {
            $data = new JsonArray($jsonData);
        } catch (\RuntimeException $exception) {
            $this->decorateBaseUrl = null;
            return  $package;
        }

        $metaPaths = [
            'downloads' => 'package/downloads/total',
            'favers'    => 'package/favers'
        ];

        foreach ($metaPaths as $metaKey => $metaPath) {
            $package->addMetaData($metaKey, $data->get($metaPath));
        }

        return $package;
    }
70359
public function getPackageRoot()
    {
        $type = $this->getPackageType();
        if ($type === self::TYPE_PSEUDO) {
            return false;
        }

        if (is_string($this->packageRoot)) {
            return $this->packageRoot;
        }

        //determine where it is located
        //luckily we know where we are in vendor folder :)
        //is there a better recommended way?
        $root = __DIR__ . '/../../..';

        //HAX using the composer package to get the root of the vendor folder
        //is there a better recommended way?
        if (class_exists(SpdxLicenses::class)
            && method_exists(SpdxLicenses::class, 'getResourcesDir')
            && realpath(SpdxLicenses::getResourcesDir() . '/../../..')
        ) {
            $root = realpath(SpdxLicenses::getResourcesDir() . '/../../..');
        }

        //if it's a root package
        if ($type === self::TYPE_ROOT) {
            $root .= '/..';
        }

        $this->packageRoot = realpath($root);

        return $this->packageRoot;
    }
1271423
public function getForPackage($package, $key, $default = null)
    {
        if (empty($this->packagesConfiguration[$package])) {
            return $default;
        }
        return Arr::get($this->packagesConfiguration[$package], $key, $default);
    }
919893
protected function getCurrentPackedDepth(): int
    {
        $depth = 0;
        foreach ($this->layers as $layer) {
            $depth += $layer->getDepth();
        }

        return $depth;
    }
947899
private static function package()
    {
        if (!self::$package) {
            self::$package = new PackageBase('cripfilesys', __DIR__);
            self::$package->publish_database = false;
            self::$package->enable_routes = false;
        }
        return self::$package;
    }
681735
public static function getGlobalVariables(AbstractPackage $package = null)
    {
        if (!static::$messages) {
            static::$messages = $package->getContainer()
                ->get('session')
                ->getFlashBag()
                ->takeAll();
        }

        $container = $package->getContainer();

        return [
            'uri' => $container->get('uri'),
            'app' => $container->get('application'),
            'package' => $package,
            'router' => $package->router,
            'asset' => $container->get('asset'),
            'messages' => static::$messages,
            'translator' => $container->get('language'),
            'datetime' => new \DateTime(
                'now',
                new \DateTimeZone($container->get('config')->get('system.timezone', 'UTC'))
            ),
        ];
    }
118825
public function package()
    {
        $package = [];
        $package['responses'] = [];
        if (!empty($this->_bundles)) {
            foreach ($this->_bundles as $bundleId => $bundle) {
                if (is_object($bundle)) {
                    $bundle = $bundle->package();
                }
                $package['responses'][$bundleId] = $bundle;
            }
        }

        return $package;
    }