Copied from the SymfonySecurityBundle.
510361
private function createRequestMatcher(ContainerBuilder $container, $path = null, $host = null, $methods = array(), $ip = null, array $attributes = array())
    {
        $serialized = serialize(array($path, $host, $methods, $ip, $attributes));
        $id = 'rollerworks_multi_user.request_matcher.'.md5($serialized).sha1($serialized);

        // Matcher already exist, which is not allowed
        if (isset($this->requestMatchers[$id])) {
            throw new \RuntimeException(sprintf(
                'There is already a request-matcher for this configuration: path: "%s", host: "%s". Only one request matcher should match for the user system.',
                $path,
                $host
            ));
        }

        if ($methods) {
            $methods = array_map('strtoupper', (array) $methods);
        }

        // only add arguments that are necessary
        $arguments = array($path, $host, $methods, $ip, $attributes);
        while (count($arguments) > 0 && !end($arguments)) {
            array_pop($arguments);
        }

        $container
            ->register($id, '%rollerworks_multi_user.matcher.class%')
            ->setPublic(false)
            ->setArguments($arguments)
        ;

        return $this->requestMatchers[$id] = new Reference($id);
    }
635093
private static function registerSymfonyYaml()
    {
        if (
            ! isset(self::$classMap['yaml'])
            and ! isset(self::$classMap['yml'])
            and class_exists(self::SYMFONY_YAML)
        ) {
            self::registerExtension('yaml', self::YAML_ADAPTER);
            self::registerExtension('yml', self::YAML_ADAPTER);
        }
    }
546332
function copy() {
    $serialized_contents = serialize($this);
    $copy = unserialize($serialized_contents);
    unset( $copy->propix );
    return $copy;
 }
1301484
private static Method getNewGetBundleMethod() {

        Class   clazz;
        Class[] args;

        clazz = ResourceBundle.class;
        args  = new Class[] {
            String.class, Locale.class, ClassLoader.class
        };

        try {
            return clazz.getMethod("getBundle", args);
        } catch (Exception e) {
            return null;
        }
    }
877328
private ResourceBundle getBundle(Locale locale) {
        return ResourceBundle.getBundle(bundleName, locale, loader, new UTF8Control());
    }
597554
public function unserialize($data)
    {
        ClosureStream::register();

        if (static::$securityProvider !== null) {
            if ($data[0] !== '@') {
                throw new SecurityException("The serialized closure is not signed. ".
                    "Make sure you use a security provider for both serialization and unserialization.");
            }

            $data = json_decode(substr($data, 1), true);

            if (!is_array($data) || !static::$securityProvider->verify($data)) {
                throw new SecurityException("Your serialized closure might have been modified and it's unsafe to be unserialized. " .
                    "Make sure you use the same security provider, with the same settings, " .
                    "both for serialization and unserialization.");
            }

            $data = $data['closure'];
        } elseif ($data[0] === '@') {
            throw new SecurityException("The serialized closure is signed. ".
                "Make sure you use a security provider for both serialization and unserialization.");
        }

        $this->code = \unserialize($data);

        // unset data
        unset($data);

        $this->code['objects'] = array();

        if ($this->code['use']) {
            $this->scope = new ClosureScope();
            $this->code['use'] = $this->resolveUseVariables($this->code['use']);
            $this->mapPointers($this->code['use']);
            extract($this->code['use'], EXTR_OVERWRITE | EXTR_REFS);
            $this->scope = null;
        }

        $this->closure = include(ClosureStream::STREAM_PROTO . '://' . $this->code['function']);

        if($this->code['this'] === $this){
            $this->code['this'] = null;
        }

        if ($this->code['scope'] !== null || $this->code['this'] !== null) {
            $this->closure = $this->closure->bindTo($this->code['this'], $this->code['scope']);
        }

        if(!empty($this->code['objects'])){
            foreach ($this->code['objects'] as $item){
                $item['property']->setValue($item['instance'], $item['object']->getClosure());
            }
        }

        $this->code = $this->code['function'];
    }
487113
public function initializeBundles()
    {
        $config = $this->getContainer()->singleton('kernel.config');
        $routing = $this->getContainer()->singleton('kernel.routing');

        $this->bundles = $this->registerBundles();

        foreach ($this->bundles as $bundle) {
            $bundle->setContainer($this->getContainer());
            $bundle->registerRouting($routing, $this->getEnvironment());
            $bundle->registerConfiguration($config, $this->getEnvironment());
        }

        unset($config, $routing);
    }
590949
protected function generateSecurity()
    {
        $securitySystemNode = $this->xpath->query('/x:webspace/x:security/x:system');
        if ($securitySystemNode->length > 0) {
            $security = new Security();
            $security->setSystem($securitySystemNode->item(0)->nodeValue);
            $this->webspace->setSecurity($security);
        }
    }
1056871
protected function registerSecurity()
    {
        /*
         * Re-create the security.yml file to avoid duplicates in merged array
         * that occur upon multiple parsing.
         */
        $fs = new Filesystem();
        if(!$fs->exists($this->configFiles['security'])){
            $fs->copy(
                $this->configFiles['security_dist'],
                $this->configFiles['security'],
                true
            );
        }

        $yamlConfig = new YamlConfig('', $this->configFiles['security_dist']);
        $appParameters = $yamlConfig->read();

        // Read content of all security.yml files and merge the arrays.
        $securityFiles = $this->kernelConfig->getSecurities();
        if (!count($securityFiles)) {
            return;
        }

        foreach ($securityFiles as $securityFile) {
            $yamlConfig = new YamlConfig('', $securityFile);
            $bundleParameters = $yamlConfig->read();
            $appParameters = VariableUtil::arrayMerge($bundleParameters, $appParameters);
        }

        $yamlConfig = new YamlConfig('', $this->configFiles['security']);
        $yamlConfig->write($appParameters, 5);
        $yamlConfig->clean();
    }
1187324
public function isAvailable(): bool
    {
        if (!file_exists("{$this->projectRootDir}/config/bundles.php")) {
            return false;
        }
        $sourcePath = "{$this->packageInstallDir}/.installer/%s/bundles.php";
        foreach ($this->projectType->getProjectDirs() as $projectDir) {
            $bundleFile = sprintf($sourcePath, $projectDir);
            if (is_file($bundleFile)) {
                return true;
            }
        }

        return false;
    }
865773
def hash_from(sym)
      starting_sym = key_as_sym(sym)
      bundle = ((starting_sym == container) ? container : { starting_sym => container[starting_sym] })
      bundle.keys.each_with_object({}) do |attr,collector|
        value = bundle[attr]
        case value
          when NestedResult, self.class
            value = value.to_hash
          when Array
            value = value.map {|ele| array_to_hash(ele) }
        end
        collector[attr] = value                                                          # new copy
      end
    end
418852
protected function readOnlySafetyCheck()
    {

        switch( static::$isReadOnly ) {

            case self::FULL_ACCESS:
                return false;
            case self::READONLY_DISABLE:
                return true;
            case self::READONLY_EXCEPTION:
                throw new ReadonlyException( "Entity is readonly" );
            case self::READONLY_ON_PERSIST:
                if( $this->isNew() !== false ) {
                    return false;
                }
                throw new ReadonlyException( "Entity has been persisted and is now readonly" );

            default:
                throw new \InvalidArgumentException( "Entity self::\$isReadonly is has a invalid argument" );

        }

    }
508885
public function indexAction() {
		$clientSettings = $this->configurationManager->getConfiguration(\TYPO3\Flow\Configuration\ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'Flowpack.SingleSignOn.Client');
		$clientSettingsYaml = \Symfony\Component\Yaml\Yaml::dump($clientSettings, 99, 2);
		$this->view->assign('clientSettings', $clientSettingsYaml);

		$authenticationSettings = $this->configurationManager->getConfiguration(\TYPO3\Flow\Configuration\ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'TYPO3.Flow.security.authentication');
		$authenticationSettingsYaml = \Symfony\Component\Yaml\Yaml::dump($authenticationSettings, 99, 2);
		$this->view->assign('authenticationSettings', $authenticationSettingsYaml);
	}
987662
def pkg_security(pkgs):
    """"""
    security_packages = Utils().read_file("/etc/slpkg/pkg_security")
    packages = []
    for read in security_packages.splitlines():
        read = read.lstrip()
        if not read.startswith("#"):
            packages.append(read.replace("\n", ""))
    for p in pkgs:
        for pkg in packages:
            if p == pkg:
                Msg().security_pkg(p)
                if not Msg().answer() in ["y", "Y"]:
                    raise SystemExit()
850859
protected function registrerSecurityFileInterface()
	{
		$this->app->bind('Mgallegos\DecimaFile\System\Repositories\File\FileInterface', function($app)
		{
			return new \Mgallegos\DecimaFile\System\Repositories\File\EloquentFile( new \Mgallegos\DecimaFile\System\File());
		});
	}
147123
private static function useOpenSslBacking()
    {
        if (!extension_loaded(self::BACKING_OPENSSL)) {
            throw new \RuntimeException(
                    'Can not use openssl backing, extension openssl not available'
            );
        }

        $key = md5(uniqid());
        $iv  = substr(md5(uniqid()), 0, openssl_cipher_iv_length('des'));
        self::$encrypt = function($value) use ($key, $iv) { return openssl_encrypt($value, 'DES', $key,  0, $iv); };
        self::$decrypt = function($value) use ($key, $iv) { return openssl_decrypt($value, 'DES', $key,  0, $iv); };
    }
1238855
@Override
	protected BundleHashcodeType isValidBundle(String requestedPath) {
		BundleHashcodeType bundleHashcodeType = BundleHashcodeType.VALID_HASHCODE;
		if (!jawrConfig.isDebugModeOn()) {
			bundleHashcodeType = binaryRsHandler.getBundleHashcodeType(requestedPath);
		}
		return bundleHashcodeType;
	}