This is a `before` trigger of an app. when the application is getting
started, we run `prepare` method to prepare the settings.
359880
public function prepare()
    {
        $this->startedAt = microtime(true);

        if ($this->getOption('debug')) {
            $this->logger->setLevel(LogLevel::DEBUG);
        } elseif ($this->getOption('verbose')) {
            $this->logger->setLevel(LogLevel::INFO);
        } elseif ($this->getOption('quiet')) {
            $this->logger->setLevel(LogLevel::ERROR);
        } elseif ($this->config('debug', false)) {
            $this->logger->setLevel(LogLevel::DEBUG);
        } elseif ($this->config('verbose', false)) {
            $this->logger->setLevel(LogLevel::INFO);
        }

        return true;
    }
278788
public function _beforeInit()
    {
        $this->pm = $this->add($this->pagemanager_class, $this->pagemanager_options);
        /** @type Controller_PageManager $this->pm */
        $this->pm->parseRequestedURL();
        parent::_beforeInit();
    }
612281
def prepare(self):
    
    cmd = [
      'android', 'update', 'project',
      '-p', self.path,
      '-t', self.get_target()
    ]
    self.run_cmd(cmd, 'prepare')
139389
public function main_init() {
		if ( $this->_initialized ) {
			return;
		}
		$this->_initialized = true;

		$this->filter->do_action( 'app_initialize', $this );
		$this->setup_property();
		$this->setup_textdomain();
		$this->setup_settings();
		$this->filter->do_action( 'app_initialized', $this );
	}
1210140
protected function _beforeLoad()
    {
        parent::_beforeLoad();
        if ($this->category && $this->category->getId()) {
            $this->applyCategory();
        }
    }
425617
protected void beforeStartElement() {
        beforeMarkup();
        if (stack.length <= depth + 1) {
            // Allocate more space for the stack:
            int[] newStack = new int[stack.length * 2];
            System.arraycopy(stack, 0, newStack, 0, stack.length);
            stack = newStack;
        }
        stack[depth + 1] = 0; // nothing written yet
    }
568866
function pre() {
      // source strings
      this.sources = [];
      this.sourceNames = */(0, _create2.default)(null);

      // bare sources
      this.bareSources = [];

      this.hasExports = false;
      this.hasModule = false;
    }
182354
def init_app(self, app):
        
        self.init_config(app)
        app.extensions['invenio-indexer'] = self

        hooks = app.config.get('INDEXER_BEFORE_INDEX_HOOKS', [])
        for hook in hooks:
            if isinstance(hook, six.string_types):
                hook = import_string(hook)
            before_record_index.connect_via(app)(hook)
307268
public function preRun(){

        if(!isset($this->parameters['target']) ){
            $this->parameters['target'] = $this->parameters['t']; 
        }

        if(!isset($this->parameters['documentRoot']) ){
            $this->parameters['documentRoot'] = $this->parameters['d'];
        }
        if(!isset($this->parameters['serverName']) ){
            $this->parameters['serverName'] = $this->parameters['s'];
        }
        if(!isset($this->parameters['tpl']) ){
            $this->parameters['tpl'] = dirname(__FILE__). '/sample/sample.conf';
        }
        
        $fileinfo =pathinfo($this->parameters['target']);
        
        if($fileinfo['extension'] != 'conf'){
            $this->err('Extension of target file has to be conf', true);
        }
    }
62790
def start_app_and_connect(self):
        
        try:
            self._start_app_and_connect()
        except AppStartPreCheckError:
            # Precheck errors don't need cleanup, directly raise.
            raise
        except Exception as e:
            # Log the stacktrace of `e` as re-raising doesn't preserve trace.
            self._ad.log.exception('Failed to start app and connect.')
            # If errors happen, make sure we clean up before raising.
            try:
                self.stop_app()
            except:
                self._ad.log.exception(
                    'Failed to stop app after failure to start and connect.')
            # Explicitly raise the original error from starting app.
            raise e
415934
function before(f, before, changeArgs){
		return changeArgs ? 
			function before_changeArgs(){
				return f.apply(this,before.apply(this,arguments));
			}:
			function before_args(){
				before.apply(this,arguments);
				return f.apply(this,arguments);
			}
	}
1292858
public function onBeforeWrite()
    {
        // Publish Icon Images:
        
        if ($this->owner->AppIconSmall()->exists()) {
            $this->owner->AppIconSmall()->publishRecursive();
        }
        
        if ($this->owner->AppIconLarge()->exists()) {
            $this->owner->AppIconLarge()->publishRecursive();
        }
        
        if ($this->owner->AppIconTouch()->exists()) {
            $this->owner->AppIconTouch()->publishRecursive();
        }
    }
916282
def prep(self, wait, args, env=None):
        
        self.pattern = wait
        self.env = env
        self.args = args

        # wait is a function, supersedes the default behavior
        if callable(wait):
            self.wait = lambda lines: wait()
591698
public function before()
    {

        // ~ Init timer
        $this->time = - microtime(true);

        // ~ Reporting all error (default: all error) !
        error_reporting((int) $this->argument->get('error-reporting', null, - 1));
        ini_set('display_errors', (bool) $this->argument->get('error-display', null, 1));

        // ~ Set limit time to 0 (default: unlimited) !
        set_time_limit((int) $this->argument->get('time-limit', null, 0));

        $this->isVerbose = ! $this->argument->has('quiet');
    }
432695
def run(self):
        
        # Make sure everything is in sync, before starting.
        self.sync_with_prompt_toolkit()

        def pre_run():
            # Start in navigation mode.
            self.application.vi_state.input_mode = InputMode.NAVIGATION

        # Run eventloop of prompt_toolkit.
        self.application.run(pre_run=pre_run)
372898
def init_app(self, app):
        

        self.__app = app
        self.__app.before_first_request(self.__setup)

        self.tracer.enabled = self.__app.config.get('TRACE_ENABLED', self.tracer.enabled)
1298565
public function on_before_render()
    {
        $pageTitle = $this->get('pageTitle');
        if (!$pageTitle) {
            $this->set('pageTitle', t($this->c->getCollectionName()));
        }
        $dbConfig = $this->app->make('config/database');
        $this->set('showPrivacyPolicyNotice', !$dbConfig->get('app.privacy_policy_accepted'));
        $this->set('token', $this->token);
        $this->set('error', $this->error);
    }