Prepare native static symbolic links for app services
@throws NativeException
498635
private function loadNativeServices(): void
    {
        // initialize memory and properties controllers
        self::$Memory = MemoryObject::instance();
        self::$Properties = new Properties();
        // initialize debugger
        if (isset($this->_services['Debug']) && $this->_services['Debug'] === true && Debug::isEnabled()) {
            self::$Debug = new Debug();
            $this->startMeasure(__METHOD__);
        }
        // prepare request data
        self::$Request = Request::createFromGlobals();
        // initialize response, securty translate and other workers
        self::$Security = new Security();
        self::$Response = new Response();
        self::$View = new View();
        self::$Translate = new Translate();
        self::$Alias = new Alias();
        self::$Event = new EventManager();
        self::$Cron = new CronManager();
        // stop debug timeline
        if (self::$Debug) {
            $this->stopMeasure(__METHOD__);
        }
    }
1152869
protected function registerDefaultBindings() {

		// Add the instance of this application.
		$this->instance( 'app', $this );

		// Adds the directory path for the framework.
		$this->instance( 'path', untrailingslashit( HYBRID_DIR  ) );

		// Add the version for the framework.
		$this->instance( 'version', static::VERSION );
	}
20226
public static function __static()
	{
		// NameValue::$nameStartChar = "[:_\p{Ll}\p{Lu}\p{Lt}\p{Lo}\p{Nl}]";
		NameValue::$nameStartChar = SchemaTypes::$nameStartChar;
		NameValue::$nameChar = SchemaTypes::$nameChar;
		NameValue::$name = SchemaTypes::$name;
		NameValue::$ncName = SchemaTypes::$ncName;
	}
1255262
public function init()
    {
        $containerPath = __DIR__ . '/../../../../../www/cache';
        $containerName = 'ContainerCore';
        $containerNamespace = 'samsonphp\core\loader';
        /** @var Module $module */
        $modules = $this->moduleManager->getRegisteredModules();

        $localModulesPath = '../src';
        ResourceMap::get('cache');
        $resourceMap = ResourceMap::get($localModulesPath);
        $localModules = $resourceMap->modules;

        if (false || !file_exists($containerPath . '/' . $containerName . '.php')) {

            $builder = new DefinitionBuilder(new ParameterBuilder());
            $xmlResolver = new XmlResolver();
            $xmlResolver->resolveFile($builder, __DIR__ . '/../../../../../app/config/config.xml');

            new Service('');
            new InjectService('');
            new InjectClass('');
            new InjectParameter('');

            foreach ($modules as $module) {
                if ($module->className && !$builder->hasDefinition($module->className)) {
                    // Fix samson.php files
                    if (!class_exists($module->className)) {
                        require_once($module->pathName);
                    }
                    /** @var ClassDefinition $classDefinition */
                    $classDefinition = $builder->addDefinition($module->className);
                    if ($id = $this->getModuleId($module->pathName)) {
                        $classDefinition->setServiceName($id);
                    } else {
                        // Generate identifier from module class
                        $classDefinition->setServiceName(
                            strtolower(ltrim(str_replace(__NS_SEPARATOR__, '_', $module->className), '_'))
                        );
                    }
                    $classDefinition->addScope(new ModuleScope())->setIsSingleton(true);
                    $this->defineConstructor($classDefinition, $module->path);
                }
            }

            $classDefinition = $builder->addDefinition(VirtualModule::class);
            $classDefinition->addScope(new ModuleScope())->setServiceName('local')->setIsSingleton(true);
            $this->defineConstructor($classDefinition, getcwd());

            foreach ($localModules as $moduleFile) {
                if (!$builder->hasDefinition($moduleFile[0])) {

                    /** @var ClassDefinition $classDefinition */
                    $classDefinition = $builder->addDefinition($moduleFile[0]);
                    $classDefinition->addScope(new ModuleScope());
                    $classDefinition->setIsSingleton(true);
                    if ($id = $this->getModuleId($moduleFile[1])) {
                        $classDefinition->setServiceName($id);
                    } else {
                        throw new \Exception('Can not get id of local module');
                    }

                    $modulePath = explode('/', str_replace(realpath($localModulesPath), '', $moduleFile[1]));
                    $this->defineConstructor($classDefinition, $localModulesPath . '/' . $modulePath[1]);
                }
            }


            /**
             * Add implementors
             */
            foreach ($this->moduleManager->implements as $interfaceName => $class) {
                $builder->defineImplementors($interfaceName, new ClassReference($class));
            }

            // Init compiler
            $reader = new AnnotationReader();
            $compiler = new DefinitionCompiler(
                new DefinitionGenerator(new ClassGenerator()),
                (new DefinitionAnalyzer())
                    ->addClassAnalyzer(new AnnotationClassAnalyzer($reader))
                    ->addClassAnalyzer(new ReflectionClassAnalyzer())
                    ->addMethodAnalyzer(new AnnotationMethodAnalyzer($reader))
                    ->addMethodAnalyzer(new ReflectionMethodAnalyzer())
                    ->addPropertyAnalyzer(new AnnotationPropertyAnalyzer($reader))
                    ->addPropertyAnalyzer(new ReflectionPropertyAnalyzer())
                    ->addParameterAnalyzer(new ReflectionParameterAnalyzer())
            );

            $container = $compiler->compile($builder, $containerName, $containerNamespace, $containerPath);

        } else {

            $containerClassName = $containerNamespace. '\\' . $containerName;
            require_once($containerPath . '/' . $containerName . '.php');
            $container = new $containerClassName();
        }

        $GLOBALS['__core'] = $container->get('core');

        $this->prepareModules($modules, $container);

        /** @var array $module */
        foreach ($localModules as $module) {
            $instance = $container->get($module[0]);
            $instance->parent = $this->getClassParentModule($container, get_parent_class($instance));
        }

//        $container->get('core')->active($container->get('local'));

        return $container;
    }
923015
function setupSymlinks (module, modulesDir, callback) {

    let details = module.split('/');
    let modulePath = resolve(NODE_MODULES, details[1]);
    let devModulePath = resolve(modulesDir, module);

    rimraf(modulePath, err => {

        if (err) {
            return callback(err);
        }

        fs.symlink(devModulePath, modulePath, err => {

            if (err) {
                return callback(err);
            }

            callback();
        });
    });
}
76350
public static function initCLI()
    {
        global $PPHP;

        self::$_PATH = array();
        self::$_req['lang']         = $PPHP['config']['global']['default_lang'];
        self::$_req['default_lang'] = $PPHP['config']['global']['default_lang'];
        self::$_req['base'] = '';
        self::$_req['binary'] = true;  // Keep layout template quiet
        self::$_req['path'] = '';
        self::$_req['query'] = '';
        self::$_req['host'] = $PPHP['config']['global']['host'];
        self::$_req['remote_addr'] = '127.0.0.1';
        self::$_req['ssl'] = $PPHP['config']['global']['use_ssl'];
        self::$_req['get'] = array();
        self::$_req['post'] = array();
        self::$_req['path_args'] = array();

        self::_initCommon();

        trigger('language', self::$_req['lang']);
    }
1048050
def symlink(parser, cmd, args):
    

    parser.add_argument(
        'apps',
        nargs=argparse.REMAINDER,
        help='Which apps to create symlinks for.'
    )
    args = parser.parse_args(args)

    base_dir, pwny_main = os.path.split(sys.argv[0])

    for app_name, config in MAIN_FUNCTIONS.items():
        if not config['symlink'] or (args.apps and app_name not in args.apps):
            continue
        dest = os.path.join(base_dir, app_name)
        if not os.path.exists(dest):
            print('Creating symlink %s' % dest)
            os.symlink(pwny_main, dest)
        else:
            print('Not creating symlink %s (file already exists)' % dest)
702144
public void bindWithApplication( String externalExportPrefix, String applicationName ) {

		Set<String> bounds = this.applicationBindings.get( externalExportPrefix );
		if( bounds == null ) {
			bounds = new LinkedHashSet<> ();
			this.applicationBindings.put( externalExportPrefix, bounds );
		}

		bounds.add( applicationName );
	}
677791
public static function init() {

		if(is_null(self::$storage)) {
			self::$storage = new NativeSessionStorage();
		}

		self::$storage->start();
		
	}
1024227
private final void decorateLocalResourceLinks(final SiteConfiguration.Tag[] links, final String prefix, final Path root) {
        if (links == null) return;
        
        for(SiteConfiguration.Tag link : links) {
            if (isLocal(link.url)) {
                link.url = deploymentInfo.translateIntoContextPath( toAddOrNotToAddModified(link.url, prefix, root) );
            }
        }
    }
818900
private void initialise() {
    try {
      addTrafficSource();
      addTrafficLayers();
    } catch (Exception exception) {
      Timber.e(exception, "Unable to attach Traffic to current style: ");
    } catch (UnsatisfiedLinkError error) {
      Timber.e(error, "Unable to load native libraries: ");
    }
  }
1359865
protected function prepareExecute()
    {
        // Prepare migration path
        $packageName = $this->getOption('p');

        /** @var AbstractPackage $package */
        $package = $this->console->getPackage($packageName);

        if ($package) {
            $dir = $package->getDir() . '/Migration';
        } else {
            $dir = $this->getOption('d');
        }

        $dir = $dir ?: $this->console->get('path.migrations');

        $this->console->set('migration.dir', $dir);

        // DB log
        $this->console->database->setDebug(true);

        $this->console->database->setMonitor(
            new CallbackMonitor(function ($query) {
                $this->console->triggerEvent('onMigrationAfterQuery', ['query' => $query]);
            })
        );
    }
414772
public function PrepareTheDefaultParametersForGeneration() {
        $this->params = array(
            \Puzzlout\Framework\GeneratorEngine\Core\BaseClassGenerator::NameSpaceKey => null,
            \Puzzlout\Framework\GeneratorEngine\Core\BaseClassGenerator::ClassNameKey => null,
            \Puzzlout\Framework\GeneratorEngine\Core\BaseClassGenerator::DestinationDirKey => null,
            \Puzzlout\Framework\GeneratorEngine\Core\BaseClassGenerator::ClassDescriptionKey => null,
            \Puzzlout\Framework\GeneratorEngine\Core\BaseClassGenerator::CultureKey => null,
            \Puzzlout\Framework\GeneratorEngine\Core\BaseClassGenerator::ClassDerivation => null,
            \Puzzlout\Framework\GeneratorEngine\Core\ConstantsClassGeneratorBase::DoGenerateConstantKeysKey => true,
            \Puzzlout\Framework\GeneratorEngine\Core\ConstantsClassGeneratorBase::DoGenerateGetListMethodKey => true,
        );
    }
820309
protected function prepareResources()
    {
        // Publish our views
        $this->loadViewsFrom(base_path("resources/views"), 'base');
        $this->publishes([
            __DIR__ .  '/views' => base_path("resources/views")
        ]);

        // Publish our migrations
        $this->publishes([
            __DIR__ .  '/migrations' => base_path("database/migrations")
        ], 'migrations');

        // Publish a config file
        $this->publishes([
            __DIR__ . '/config' => base_path('/config')
        ], 'config');

        // Publish our routes
        $this->publishes([
            __DIR__ .  '/routes.php' => base_path("app/Http/comments_routes.php")
        ], 'routes');

        // Include the routes file
        if(file_exists(base_path("app/Http/comments_routes.php")))
            include base_path("app/Http/comments_routes.php");
    }
572241
@Override
  public final void prepareNarInfo(final File baseDir, final MavenProject project, final NarInfo narInfo,
      final AbstractNarMojo mojo) throws MojoExecutionException {
    if (getIncludeDirectory(baseDir, project.getArtifactId(), project.getVersion()).exists()) {
      narInfo.setNar(null, "noarch", project.getGroupId() + ":" + project.getArtifactId() + ":" + NarConstants.NAR_TYPE
          + ":" + "noarch");
    }

    final String[] binAOL = new File(baseDir, "bin").list();
    for (int i = 0; binAOL != null && i < binAOL.length; i++) {// TODO: chose
                                                               // not to apply
                                                               // new file
                                                               // naming for
                                                               // outfile in
                                                               // case of
                                                               // backwards
                                                               // compatability,
                                                               // may need to
                                                               // reconsider
      narInfo.setNar(null, Library.EXECUTABLE, project.getGroupId() + ":" + project.getArtifactId() + ":"
          + NarConstants.NAR_TYPE + ":" + "${aol}" + "-" + Library.EXECUTABLE);
      narInfo.setBinding(new AOL(binAOL[i]), Library.EXECUTABLE);
      narInfo.setBinding(null, Library.EXECUTABLE);
    }

    final File libDir = new File(baseDir, "lib");
    final String[] libAOL = libDir.list();
    for (int i = 0; libAOL != null && i < libAOL.length; i++) {
      String bindingType = null;
      final String[] libType = new File(libDir, libAOL[i]).list();
      for (int j = 0; libType != null && j < libType.length; j++) {
        narInfo.setNar(null, libType[j], project.getGroupId() + ":" + project.getArtifactId() + ":"
            + NarConstants.NAR_TYPE + ":" + "${aol}" + "-" + libType[j]);

        // set if not set or override if SHARED
        if (bindingType == null || libType[j].equals(Library.SHARED)) {
          bindingType = libType[j];
        }
      }

      final AOL aol = new AOL(libAOL[i]);
      if (mojo.getLibsName() != null) {
        narInfo.setLibs(aol, mojo.getLibsName());
      }
      if (narInfo.getBinding(aol, null) == null) {
        narInfo.setBinding(aol, bindingType != null ? bindingType : Library.NONE);
      }
      if (narInfo.getBinding(null, null) == null) {
        narInfo.setBinding(null, bindingType != null ? bindingType : Library.NONE);
      }
    }
  }
355883
static function Init()
	{
		require_once 'verysimple/Phreeze/Controller.php';
		require_once 'verysimple/HTTP/RequestUtil.php';

		if (!self::$IS_INITIALIZED)
		{
			RequestUtil::NormalizeUrlRewrite();

			Controller::$SmartyViewPrefix = '';
			Controller::$DefaultRedirectMode = 'header';

			self::$IS_INITIALIZED = true;
		}

	}
1025583
protected static function _prepare()
    {
        if (empty(static::$_module)) {
            $module = Module::getModuleByClassname(Module::className());
            if (!empty($module)) {
                static::$_sysControllerUid = "/sys/main";
                static::$_routeActionView = "/{$module->uniqueId}/main/view";
                static::$_routeActionShow = "/{$module->uniqueId}/main/show";
                static::$_model = $module::model(self::MODEL_ALIAS);
            }
        }
    }