Extrái as anotações da classe e registra controladores ou serviços.

@param string              $class
@param PackServiceProvider $pack
18132
public function readAnnotations($class, $pack)
    {
        $reader = new AnnotationReader();

        $reflectionClass = new \ReflectionClass($class);
        $classAnnotations = $reader->getClassAnnotations($reflectionClass);

        foreach ($classAnnotations as $annotation) {
            if ($annotation instanceof Controller) {
                $this->ctrlRegister->register($annotation, $reflectionClass, $pack);
            }
        }
    }
346528
protected function define(PackageDefinition $package)
    {
        $package->name('faqs');

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

        $package->modules([
            'faqs' => FaqModule::class,
        ]);
    }
283230
protected function addLoaderFile(string $file, string $locale = null): void
	{
		if ($this->loader === null) {
			$builder = $this->getContainerBuilder();

			$loader = $builder->getByType(LoaderFactory::class);
			$this->loader = $builder->getDefinition($loader);
		}
		$this->loader->addSetup('addFile', [$file, $locale]);
	}
575207
protected function addServiceProvider($targetModuleName, $serviceProviderClass)
    {
        $serviceProvider = $this->moduleDirectoryName . '\\' . $targetModuleName . '\\' . $serviceProviderClass;
        Utils::addServiceProvider($serviceProvider);
    }
106011
public static function autoloader($class) {
		$class = ltrim($class, '\\');
		if (class_exists($class, false) || interface_exists($class, false)) {
			return;
		}
		$whitelisted = ['Memcached', 'PHPUnit', 'Symfony'];
		foreach ($whitelisted as $v) {
			if (strpos($class, $v) === 0) return;
		}
		// we need to check if we have customization for classes, we only allow 
		// customizaton for models and controllers
		$file = str_replace(['_', '\\'], DIRECTORY_SEPARATOR, $class) . '.php';
		// we need to store class path so we can load js, css and scss files
		self::$settings['application']['loaded_classes'][$class] = [
			'class' => $class,
			'file' => $file,
			'media' => []
		];
		// debuging
		if (class_exists('Debug', false) && \Debug::$debug) {
			\Debug::$data['classes'][] = ['class' => $class, 'file' => $file];
		}
		require_once($file);
	}
169649
public function create($pack, $author, $email)
    {
        $fs = new Filesystem();

        if (!$this->sourceDir) {
            throw new \Exception('O diretório de código fonte "singular.directory.src" da aplicação não foi definido!');
        }

        $packDir = $this->getPackDir($pack);

        if ($fs->exists($packDir)) {
            throw new \Exception(sprintf('O pacote %s já foi criado!', $pack));
        }

        $this->createDirectories($packDir);
        $this->createPackServiceProvider($pack, $packDir, $author, $email);
    }
35107
public function setPackage($package)
    {
        if ($package != $this->package) {
            $this->layoutLocation = null;
        }
        $this->package = $this->treatPackageName($package);
    }
503598
public function resolve($annotation, $reflectionClass, $pack)
    {
        $app = $this->app;

        $snakeClass = implode('_',preg_split('/(?=[A-Z])/', $reflectionClass->getShortName(), -1, PREG_SPLIT_NO_EMPTY));
        $relativeNamespace = preg_replace('/'.$pack->getNameSpace().'/', '', $reflectionClass->getName(), 1);
        list($empty, $serviceDir, $serviceClass) = explode('\\', $relativeNamespace);
        $serviceKey = implode('.',[$pack->getPackName(),strtolower($serviceDir), strtolower($snakeClass)]);

        $class = $reflectionClass->getName();
        switch ($annotation->type) {
            case 'factory':
                $app[$serviceKey] = $app->factory(function () use ($class, $app, $pack) {
                    return new $class($app, $pack);
                });
            break;
            case 'shared':
                $app[$serviceKey] = function () use ($class, $app, $pack) {
                    return new $class($app, $pack);
                };
            break;
            case 'protected':
                $app[$serviceKey] = $app->protect(function () use ($class, $app, $pack) {
                    return new $class($app, $pack);
                });
            break;
        }

        $this->registerParameters($reflectionClass, $serviceKey);
    }
1074920
public function addPackage($name, AbstractPackage $package)
    {
        $this->container->get('package.resolver')->addPackage($name, $package);

        return $this;
    }
888926
protected function define(PackageDefinition $package)
    {
        $package->name('contact-us');

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

        $package->modules([
            'contact-enquiries' => ContactEnquiryModule::class,
        ]);
    }
207177
@Override
    public T addPackage(String pack) throws IllegalArgumentException {
        Validate.notNull(pack, "Package must be specified");

        return addPackages(false, pack);
    }
1065446
public function loader($class)
    {
        if (isset($this->aliases[$class])) {
            class_alias($this->aliases[$class], $class);
            return;
        }

        if ($this->namespacing) {
            if ($alias = $this->getNamespaceAlias($class)) {
                class_alias($this->aliases[$alias], $class);
            }
        }
    }
1366361
public static function registerPackage(Event $event)
    {
        $installedPackage = $event->getOperation()->getPackage();

        if (!self::isBundle($installedPackage)) {
            return;
        }

        self::enablePackage($installedPackage);
    }
126250
public function packerThreePack($data)
    {
        $encoded = base64_encode($data);

        // Separa em dois pedaços
        $partOne = mb_substr($encoded, 0, 15, "utf-8");
        $partTwo = mb_substr($encoded, 15, null, "utf-8");

        // Insere 'Sg' para invalidar o base64
        return $partOne . 'Sg' . $partTwo;
    }
749376
public function setLoader(ServiceLoader $loader){

		$this->loader = $loader;
		$that = $this;

		$this->loader->addInitializer(function ($instance) use ($that) {

		    // Inject broker to services
		    if ($instance instanceof Feature\ServiceBrokerAwareInterface) {
		        $instance->setServiceBroker($that);
		    }

		    // Inject event manager to services
		    if ($instance instanceof EventManagerAwareInterface) {
		        $instance->setEventManager($that->getEventManager());
		    }
		});

		return $this;
	}
288230
protected function addPackage(ComposerPackage $package)
    {
        $plugin = $this->rep->find($package->getName());

        // create new plugin if not exists
        if (!$plugin) {
            $plugin = new Plugin();
            $plugin->setName($package->getName());
        }

        list($vendor, $package) = explode('/', $plugin->getName());

        try {
            $data = $this->client->getPlugin($vendor, $package);
            $plugin->setTitle($data['title'])->setDescription($data['description']);
            if ($data['logo']) {
                $this->downloader->entity($data['logo'], $plugin, true);
            }
        } catch (\Exception $e) {
            // is not a critical error
        }

        $this->em->persist($plugin);
        $this->em->flush();
    }
1223924
public static function createForMissingDependency(
        string $format,
        string $missingClass,
        string $package
    ): self {
        return new self(sprintf('Exporter %s not available. Missing class %s. To resolve it, add %d in your composer',
            $format,
            $missingClass,
            $package
        ));
    }