extraction of module package

@param Listener $listener
@param String $category
@param array $input
4223
public function extract(Listener $listener, $category = null, array $input)
    {

        try {
            $subdir = !is_null($category) ? $category : 'addons';
            $target = realpath(app_path() . "/../src/modules/{$subdir}");
            if (!is_dir($target)) {
                throw new \Exception('Invalid path of module provided');
            }

            $name = $input['name'];
            $path = storage_path() . '/app/uploads/' . $name;
            if (!file_exists($path)) {
                throw new \Exception('Invalid path of module package');
            }

            if ($this->unzip($path, $target)) {
                return $listener->moduleExtracted($category);
            }
            return $listener->moduleExtractionError($category);
        } catch (\Exception $e) {
            Log::emergency($e);
            return $listener->moduleExtractionError($category);
        }
    }
1125902
public function update($listener, array $input, $id)
    {
        if ((int) $id !== (int) $input['id']) {
            return $listener->userVerificationFailed();
        }

        $validation = $this->validator->on('update')->bind(['roleID' => $id])->with($input);

        if ($validation->fails()) {
            return $listener->updateValidationFailed($validation, $id);
        }

        $role = $this->model->findOrFail($id);

        try {
            $this->saving($role, $input, 'update');
        } catch (Exception $e) {
            return $listener->updateFailed(['error' => $e->getMessage()]);
        }

        return $listener->updateSucceed($role);
    }
822410
public function delete(LanguageListener $listener, $id)
    {
        DB::beginTransaction();
        try {

            $language = Languages::query()->findOrFail($id);
            if ($language->is_default) {
                throw new Exception(trans('antares/translations::messages.unable_to_delete_default_language'));
            }
            $code = $language->code;
            $language->delete();

            $vendor = base_path('src');
            foreach (['core/foundation', 'core/licensing'] as $dir) {
                $path = implode(DIRECTORY_SEPARATOR, [$vendor, $dir, 'resources', 'lang', $code]);
                $this->deleteLangFiles($path);
            }
            $directories = $this->filesystem->directories($vendor . DIRECTORY_SEPARATOR . 'components');
            foreach ($directories as $directory) {
                $path = implode(DIRECTORY_SEPARATOR, [$directory, 'resources', 'lang', $code]);
                $this->deleteLangFiles($path);
            }
        } catch (Exception $e) {
            DB::rollback();
            return $listener->deleteFailed($e->getMessage());
        }
        DB::commit();
        return $listener->deleteSuccess();
    }
524668
public function addListener(Listener $listener) : void {
        $this->listeners = $this->listeners->add($listener);
    }
1273295
public function AttachObserver($listener)
	{
		if ($listener) {
			$this->_observers[] =& $listener;
			if ($this->_masterAdapter) $this->_masterAdapter->AttachObserver($listener);
		}
		
	}
897217
static private function getListener($listener)
    {
        $listenerClassName = Ioc::resolveClassName($listener);
    	if (!isset(self::$_elInstances[$listenerClassName])) {
    		if (!($listener instanceof EventListenerInterface)) {
    			$listener = Ioc::createObject($listener);
    		}
    		self::$_elInstances[$listenerClassName] = $listener;
    	}
    	
    	return self::$_elInstances[$listenerClassName];
    }
1007092
public function fatal( $object , $category , $message )
	{
		$this->message( self::getMessagePrefix( $object , $category , 'fatal' ) . $message , self::LEVEL_FATAL );

		throw new Exception( $message );
	}
443111
public function prepare($listener)
    {
        if (! $this->requirements->check()) {
            return $listener->preparationNotCompleted();
        }

        $this->installer->migrate();

        return $listener->preparationCompleted();
    }
1021638
public function error( $object , $category , $message )
	{
		return $this->message( self::getMessagePrefix( $object , $category , 'error' ) . $message , self::LEVEL_ERROR );
	}
945092
protected function getModuleByTransCategory($category)
    {
        foreach(TranslationsBuilder::$transCatToModule as $pattern => $module) {
            if (0 === strpos($category, rtrim($pattern, '*'))) {
                return $module;
            }
        }
    }
477723
protected function checkListener(EventSubscriberInterface $subscriber, $event, $listener)
    {
        if (is_string($listener)) {
            // Add the default priority and use the default validation.
            $listener = array($listener, 0);
        }
        if (!is_array($listener)) {
            $this->addProblem(sprintf('Listener definition for event "%s" must be an array or a string.', $event));
            return;
        }
        if ($this->containsSeveralSubscriptions($listener)) {
            foreach ($listener as $subListener) {
                $this->checkListener($subscriber, $event, $subListener);
            }
            return;
        }
        if (count($listener) === 1) {
            // Method without priority.
            $listener[] = 0;
        }

        if (count($listener) !== 2) {
            $message = 'Listener definition for event "%s" must consist of a method and a priority, but received: %s';
            $this->addProblem(sprintf($message, $event, $this->exporter->export($listener)));
            return;
        }
        list($method, $priority) = $listener;
        $this->checkMethod($subscriber, $event, $method);
        $this->checkPriority($event, $priority);
    }
863674
public function debug($message, string $category = 'application'): void
    {
        $this->log(LogLevel::DEBUG, $message, $category);
    }
1085302
public static function listModules(Event $event)
    {
        $packageRepository = new PackageRepository();
        $packageRepository->injectComposer($event->getComposer());

        $modules = $packageRepository->findModules();
        $maximumPackageNameLength = static::calculateMaximumPackageNameLength($modules);

        foreach ($modules as $module) {
            $paddedName = str_pad($module->getName(), $maximumPackageNameLength + 1);
            echo $paddedName . ' ' . $module->getPrettyVersion() . PHP_EOL;
        }
    }
740029
public function getMessages($category, $language)
    {
        $key = $language . '/' . $category;
        if (!isset($this->_messages[$key])) {
            $this->_messages[$key] = $this->loadMessages($category, $language);
        }

        return $this->_messages[$key];
    }
399727
public function translate($category, $message, $params, $language)
    {
        if (stripos($message, '{lang:') !== false) {
            $message = $this->removeLegacyLangTags($message);
        }

        return parent::translate($category, $message, $params, $language);
    }
506157
public function copyModuleFiles(PackageEvent $event): void
    {
        $package = $this->extractPackage($event);
        $this->packagePath = $this->vendorPath .DS. $package->getName();
        if ($package->getType() === 'bluz-module' && file_exists($this->packagePath)) {
            if ($package->getExtra() && isset($package->getExtra()['copy-files'])) {
                $this->copyExtras($package->getExtra()['copy-files']);
            }
            $this->copyModule();
        }
    }
17791
protected function setupWildcardListen($event, $listener)
    {
        $this->wildcards[$event][] = $this->makeListener($listener, true);

        $this->wildcardsCache = [];
    }