Get details of an application.

@param $applicationName
@return Application
@throws NotFoundException
431187
public function getApplication($applicationName)
    {
        $uri = "applications/$applicationName";
        try {
            $response = $this->client->getEndpoint()->get($uri);
        } catch (RequestException $e) {
            $this->processRequestException($e);
        }

        return new Application($this->client, \GuzzleHttp\json_decode($response->getBody()));
    }
658692
public function setName($name)
    {
        if (null !== $name) {
            Assert::string($name, 'The application name must be a string. Got: %s');
            Assert::notEmpty($name, 'The application name must not be empty.');
            Assert::regex($name, '~^[a-zA-Z0-9\-]+$~', 'The application name must contain letters, numbers and hyphens only. Did you mean to call setDisplayName()?');
        }

        $this->name = $name;

        return $this;
    }
494682
public function getOneActivity(string $filename, string $appname)
    {
        return ((new Renderer())->jsonRenderer(array("code" => 200, "msg" => "OK", "results" =>
            $this->getMercureContent($filename, $appname))));
    }
384105
public function getApplication($key)
    {
        if (empty($key)) {
            return null;
        }

        if (array_key_exists($key, $this->applications)) {
            return $this->applications[$key];
        }

        return null;
    }
965038
public function EnabledApplication($ApplicationFolder = '') {
      if ($ApplicationFolder == '')
         $ApplicationFolder = $this->_ApplicationFolder;

      foreach (Gdn::ApplicationManager()->AvailableApplications() as $ApplicationName => $ApplicationInfo) {
         if (GetValue('Folder', $ApplicationInfo, FALSE) === $ApplicationFolder) {
            $EnabledApplication = $ApplicationName;
            $this->EventArguments['EnabledApplication'] = $EnabledApplication;
            $this->FireEvent('AfterEnabledApplication');
            return $EnabledApplication;
         }
      }
      return FALSE;
   }
354270
public function DisableApplication($ApplicationName) {
      // 1. Check to make sure that this application is allowed to be disabled
      $ApplicationInfo = ArrayValueI($ApplicationName, $this->AvailableApplications(), array());
      $ApplicationName = $ApplicationInfo['Index'];
      if (!ArrayValue('AllowDisable', $ApplicationInfo, TRUE))
         throw new Exception(sprintf(T('You cannot disable the %s application.'), $ApplicationName));

      // 2. Check to make sure that no other enabled applications rely on this one
      foreach ($this->EnabledApplications() as $CheckingName => $CheckingInfo) {
         $RequiredApplications = ArrayValue('RequiredApplications', $CheckingInfo, FALSE);
         if (is_array($RequiredApplications) && array_key_exists($ApplicationName, $RequiredApplications) === TRUE) {
            throw new Exception(sprintf(T('You cannot disable the %1$s application because the %2$s application requires it in order to function.'), $ApplicationName, $CheckingName));
         }
      }

      // 2. Disable it
      RemoveFromConfig("EnabledApplications.{$ApplicationName}");

      // Clear the object caches.
      Gdn_Autoloader::SmartFree(Gdn_Autoloader::CONTEXT_APPLICATION, $ApplicationInfo);

      // Redefine the locale manager's settings $Locale->Set($CurrentLocale, $EnabledApps, $EnabledPlugins, TRUE);
      $Locale = Gdn::Locale();
      $Locale->Set($Locale->Current(), $this->EnabledApplicationFolders(), Gdn::PluginManager()->EnabledPluginFolders(), TRUE);
      
      $this->EventArguments['AddonName'] = $ApplicationName;
      Gdn::PluginManager()->CallEventHandlers($this, 'ApplicationManager', 'AddonDisabled');
   }
67232
public function getService($serviceName)
    {
        $serviceName = $this->getServiceName($serviceName);

        return $this->getApp()->container->get($serviceName);
    }
669260
final protected function checkAppName(string $appname):int
    {
        if ($appname == "App" || strpos($appname, "App") == false ||
            preg_match('/[\'^£$%&*()}{@#~?><>,|=+¬-]/', $appname)) {
            return (-1);
        }
        return (1);
    }
1237707
public function get($name)
    {
        if (!isset($this->parameters[$name])) {
            throw new ParameterNotFoundException("The requested parameter '{$name}' doesn't exist.");
        }

        return $this->parameters[$name];
    }
71414
public function getOneLocaleActivity(string $appname):Renderer
    {

        $locale = new AppLocale($appname);
        $localeFormat =  ["app" => $appname, "enabled" => $locale->isEnabled(), "values" => $locale->getValues(),
            "prefered" => $locale->getPrefer(), "transtype" => $locale->getTranstype()];

        return ((new Renderer())->jsonRenderer(array("code" => 200, "results" => $localeFormat)));
    }
718998
public function getApp(ApiApplication $application)
    {
        $user = $this->getAuthenticatedUser();
        $account = $this->getApiAccountRepository()->findByUserAndApplication($user, $application);
        $token = $account
            ? $this->getApiOAuthTokenRepository()->findDeveloperToken($account)
            : null;

        if (! $account) {
            throw new AccessDeniedHttpException();
        }

        $deliveries = $this->getWebhookDeliveryRepository()
            ->findLastDeliveries($account->getApplication(), 10);

        return $this->render('developers/application.html.twig', [
            "application" => $application,
            "deliveries"  => $deliveries,
            "user"        => $user,
            "token"       => $token,
        ]);
    }
576082
@Programmatic
    public ApplicationUser findByUsernameCached(final String username) {
        return queryResultsCache.execute(new Callable<ApplicationUser>() {
            @Override public ApplicationUser call() throws Exception {
                return findByUsername(username);
            }
        }, ApplicationUserRepository.class, "findByUsernameCached", username);
    }
722146
public static function get(string $param, string $appname = null)
    {
        if (isset(self::$framework_paths[$param])) {
            if (!is_array(self::$framework_paths[$param]) &&
                strpos(self::$framework_paths[$param], "%app_name%") !== false) {
                if ($appname != null) {
                    return (str_replace(
                        "%app_name%",
                        $appname,
                        self::$framework_paths[$param]
                    ));
                } elseif (isset(self::$framework_paths["app.call"])) {
                    return (str_replace(
                        "%app_name%",
                        self::$framework_paths["app.call"],
                        self::$framework_paths[$param]
                    ));
                } else {
                    throw new Server500(new ArrayObject(array("explain" =>
                        "Undefined [app.call] index", "solution" =>
                        "Please refer to the framework documentation to get the proper path.")));
                }
            } else {
                return (self::$framework_paths[$param]);
            }
        } else {
            throw new Server500(new ArrayObject(array("explain" =>
                "Undefined [$param] path", "solution" =>
                "Please refer to the framework documentation to get the proper path.")));
        }
    }
887994
public function &getAppInstance(string $name)
    {
        if (empty($name)) {
            Throw new FrameworkException('Core::getAppInstance() needs an app name');
        }

        $string = new CamelCase($name);
        $name = $string->camelize();

        // App instances are singletons!
        if (!array_key_exists($name, $this->apps)) {

            // Create class name
            $class = '\Apps\\' . $name . '\\' . $name;

            //
            $filename = $this->basedir . str_replace('\\', DIRECTORY_SEPARATOR, $class) . '.php';

            if (!file_exists($filename)) {
                Throw new FrameworkException(sprintf('Apps could not find an app classfile "%s" for app "%s"', $name, $filename));
            }

            // Default arguments for each app instance
            $args = [
                $name,
                $this->config->createStorage($name),
                $this
            ];

            $instance = $this->di->instance($class, $args);

            if (!$instance instanceof AbstractApp) {
                Throw new FrameworkException('Apps must be an instance of AbstractApp class!');
            }

            $instance->setName($name);
            $instance->language->setCode($this->config->get('Core', 'site.language.default'));

            $this->apps[$name] = $instance;
        }

        return $this->apps[$name];
    }
535163
public function get($applicationCreditId, array $fields = array())
    {
        $params = array();
        if (!empty($fields)) {
            $params['fields'] = implode(',', $fields);
        }
        $endpoint = '/admin/application_credits/'.$applicationCreditId.'.json';
        $data = $this->request($endpoint, 'GET', $params);
        return $this->createObject(ApplicationCredit::class, $data['application_credit']);
    }
675722
public static function getApplicationName():?string
    {
        if (self::isCliApp()) {
            return self::$APPLICATION_NAME;
        }

        return MSession::get(MCoreApplication::APPLICATION_NAME);
    }
1062839
public function &getAppInstance(string $name)
    {
        if (empty($name)) {
            Throw new AppHandlerException('AppHandler::getAppInstance() method needs a camelized appname.');
        }

        $string = new CamelCase($name);
        $name = $string->camelize();

        // App instances are singletons!
        if (!array_key_exists($name, $this->instances)) {

            // Create class name
            $class = '\AppHandler\\' . $name . '\\' . $name;

            //
            $filename = BASEDIR . str_replace('\\', DIRECTORY_SEPARATOR, $class) . '.php';

            if (!file_exists($filename)) {
                Throw new AppHandlerException(sprintf('AppHandler could not find an app classfile "%s" for app "%s"', $name, $filename));
            }

            // Default arguments for each app instance
            $args = [
                $name,
                $this,
                $this->config->getStorage($name),
                'core.page',
                'core.di'
            ];

            $instance = $this->di->instance($class, $args);

            if (!$instance instanceof AbstractApp) {
                Throw new AppHandlerException('AppHandler must be an instance of AbstractApp class!');
            }

            $instance->setName($name);

            $this->instances[$name] = $instance;
        }

        return $this->instances[$name];
    }