Generate and return the public API

@return string JavaScript Code
480452
protected function getExports()
	{
		if (empty($this->exports))
		{
			return '';
		}

		$exports = [];
		foreach ($this->exports as $export)
		{
			$exports[] = "'" . $export . "':" . $export;
		}
		sort($exports);

		return "window['s9e']['TextFormatter'] = {" . implode(',', $exports) . '}';
	}
217070
protected function getInlineJavaScript()
    {
        static $shown = false;

        if (!$shown) {
            $javascript = $this->getInlineJavaScriptTranslations();
            $shown = true;
        } else {
            $javascript = '';
        }

        $values = array();
        if ($this->show_blank) {
            $values[] = "''";
        }

        foreach ($this->action_items as $item) {
            if ($item->visible) {
                $values[] = SwatString::quoteJavaScriptString($item->id);
            }
        }

        $selected_value =
            $this->selected === null
                ? 'null'
                : SwatString::quoteJavaScriptString($this->selected->id);

        $javascript .= sprintf(
            "var %s_obj = new SwatActions(%s, [%s], %s);",
            $this->id,
            SwatString::quoteJavaScriptString($this->id),
            implode(', ', $values),
            $selected_value
        );

        if ($this->view !== null && $this->selector !== null) {
            $javascript .= sprintf(
                "\n%s_obj.setViewSelector(%s, '%s');",
                $this->id,
                $this->view->id,
                $this->selector->getId()
            );
        }

        return $javascript;
    }
950264
public function getAuctionApi()
    {
        if (!$this->apis->has('auction')) {
            $this->apis->set('auction', new Auction($this));
        }

        return $this->apis->get('auction');
    }
421310
public function generate()
	{
		if (TL_MODE == 'BE')
		{
			$objTemplate = new \BackendTemplate('be_wildcard');

			$objTemplate->wildcard = '### DOCUMENT MANAGEMENT SYSTEM - LISTING ###';
			$objTemplate->title = $this->headline;
			$objTemplate->id = $this->id;
			$objTemplate->link = $this->name;
			$objTemplate->href = 'contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $this->id;

			return $objTemplate->parse();
		}

		return parent::generate();
	}
863030
protected function generateAPI()
    {
        $srcPath = Strata::getSRCPath();
        $vendorPath = Strata::getVendorPath();
        $tmpPath = Strata::getTmpPath();

        $this->output->writeLn("<info>Generating API</info>");
        $this->output->writeLn($this->tree(true) . "Scanning $srcPath");
        $this->nl();

        if (!file_exists($tmpPath . "phploc.xml")) {
            touch($tmpPath . "phploc.xml");
        }

        if (!file_exists($tmpPath . "phpcs.xml")) {
            touch($tmpPath . "phpcs.xml");
        }

        system(sprintf("%sbin/phploc  --log-xml %sphploc.xml test", $vendorPath, $tmpPath));
        system(sprintf("%sbin/phpcs src --standard=PSR2 --report-xml=%sphpcs.xml", $vendorPath, $tmpPath));
        system(sprintf("%sbin/phpdox", $vendorPath));
    }
668544
protected function getInlineJavaScript()
    {
        $open = $this->open ? 'true' : 'false';
        return sprintf(
            "var %s_obj = new %s('%s', %s);",
            $this->id,
            $this->getJavaScriptClass(),
            $this->id,
            $open
        );
    }
900387
protected function api()
    {
        if (!isset($this->api)) {
            $this->api = $this->getService('api');
            $this->api
                ->dispatcher
                ->addListener('login_required', [$this, 'login']);
            $this->api
                ->dispatcher
                ->addListener('environments_changed', [$this, 'updateDrushAliases']);
        }

        return $this->api;
    }
886656
public function getScript() {
		$jsCode="$('".$this->attachTo." a').click(function (event) { event.preventDefault();$(this).tab('show');});";
		$this->jquery_code_for_compile []=$jsCode;
		$this->compileEvents();
		return $this->compileJQueryCode();
	}
1053750
public function generate()
	{
		if ($this->imageSubmit)
		{
			$objModel = \FilesModel::findByPk($this->singleSRC);

			if ($objModel !== null && is_file(TL_ROOT . '/' . $objModel->path))
			{
				return sprintf('<button type="submit" id="ctrl_%s" class="submit btn %s" title="%s" alt="%s"%s>%s</button>',
					$this->strId,
					(($this->strClass != '') ? ' ' . $this->strClass : 'btn-default'),
					specialchars($this->slabel),
					specialchars($this->slabel),
					$this->getAttributes(),
					\Image::getHtml($objModel->path, $this->slabel)
				);
			}
		}

		$label = specialchars($this->slabel);

		if($this->bootstrap_addIcon) {
			$icon = Icons::generateIcon($this->bootstrap_icon);

			if($this->bootstrap_iconPosition == 'right') {
				$label = $label . ' ' . $icon;
			}
			else {
				$label = $icon  . ' ' . $label;
			}
		}

		// Return the regular button
		return sprintf('<button type="submit" id="ctrl_%s" class="submit btn %s"%s>%s</button>',
			$this->strId,
			(($this->strClass != '') ? $this->strClass : 'btn-default'),
			$this->getAttributes(),
			$label
		);
	}
1325590
public function getApiRequest()
    {
        if (empty($_SERVER['REQUEST_URI'])) {
            return "";
        }
        
        $api_request = $_SERVER['REQUEST_URI'];
        
        if (!empty($_SERVER['QUERY_STRING'])) {
            $api_request = str_replace($_SERVER['QUERY_STRING'], "", $api_request);
        }
        
        $api_request = rtrim($api_request, "/?");
        
        $api_base = str_replace(basename($_SERVER['SCRIPT_NAME']), "", $_SERVER['SCRIPT_NAME']);
        
        $api_base = rtrim($api_base, "/");
        
        //echo $api_request . "<br>";
        //echo $api_base . "<br>";
        
        return trim(str_replace($api_base, "", $api_request), "/");
    }
659736
public function getScript()
    {
        $di = jaxon()->di();
        $code = '';
        foreach(array_keys($this->aFunctions) as $sName)
        {
            $xFunction = $di->get($sName);
            $code .= $xFunction->getScript();
        }
        return $code;
    }
810410
public function generateRandomApiKey()
    {
        $this->_api_key_private = md5($this->_id . uniqid());

        $this->_api_key_public = $this->generateApiPublicKey();

        return $this;
    }
1310805
public function createAuthCode()
	{
		$authParams = Authorizer::getAuthCodeRequestParams();
		$formParams = array_except($authParams,'client');
		$formParams['client_id'] = $authParams['client']->getId();

		$scope_collection = new \Illuminate\Database\Eloquent\Collection();
		foreach($authParams['scopes'] as $scope)
		{
			$scope_collection->add(Scope::findOrFail($scope->getId()));
		}
		return view('oauth.authorization-form')
			->with('params', $formParams)
			->with('client', $authParams['client'])
			->with('scopes', $scope_collection);
	}
950671
public function getJavascripts()
    {
        $self = $this;
        $parse_javascripts = function ($params, $javascripts) use ($self) {
            foreach ($params as $js) {

                if (is_string($js)) {
                    $js = array(
                        'path'  => $js,
                    );
                } elseif (isset($js['route'])) {
                    $js = array(
                        'path'  => $self->getGenerator()
                                        ->getContainer()
                                        ->get('router')
                                        ->generate($js['route'], $js['routeparams'])
                    );
                }

                $javascripts[] = $js;
            }

            return $javascripts;
        };

        // From config.yml
        $javascripts = $parse_javascripts(
            $this->getGenerator()->getContainer()
                 ->getParameter('admingenerator.javascripts', array()), array()
        );

        // From generator.yml
        $javascripts = $parse_javascripts(
            $this->getVariable('javascripts', array()), $javascripts
        );

        return $javascripts;
    }
585607
public function generateCode()
    {
        $refClass = new ReflectionClass($this->className);
        $this->finalClassesCanNotBeMocked($refClass);

        $this->methods = array();
        $this->makeAllAbstractMethodsThrowException($refClass);
        if (!$this->niceMock || $refClass->isInterface()) {
            $this->makeAllMethodsThrowException($refClass);
        }
        $this->renderRules();
        $this->renderConstructor();
        $this->renderClone();
        $this->exposeMethods();
        $this->setUpGetCallsForMethod();

        $code = $this->getNamespaceCode();
        $methods = implode("\n", $this->methods);
        $superWord = $this->getSuperWord($refClass);

        $class = "class {$this->getMockName()} $superWord \\{$this->className}";
        if ('implements' === $superWord) {
            $class .= ', ';
        } else {
            $class .= ' implements ';
        }
        $class .= '\Concise\Mock\MockInterface';

        return $code .
        "$class { public static \$_methodCalls = array(); $methods }";
    }
886549
public function getElement()
    {
        if ($this->getDocblock()) {
            $this->setLines($this->getDocblock()->getElement());
        }
        $name = '';
        if ($this->getName()) {
            $name = ($this->isPublic() ? 'public ' : '').
                ($this->isStatic() ? 'static ' : '').
                'function '.$this->getName();
        }

        $params = array();
        foreach ($this->getParams() as $param => $type) {
            $params[] = ($type?$type.' ':'').'$'.$param;
        }
        $this->addLine($name.'('.implode(', ', $params).')');

        $this->startBlock();
        $this->addLine($this->getContent());
        $this->endBlock();
        return $this->getLines();
    }
1162220
public function getApi()
    {
        if (!isset($this->_api)) {
            $this->_api = ComConnectHelperApi::getApi($this->get('api'));
            $this->_api->setToken($this->tokenKey, $this->tokenSecret);
        }

        return $this->_api;
    }