original_string: public static function factory(array $config)
      {
          // Determine whether we are whitelisting or blacklisting
          $denyByDefault = false;
          if (array_key_exists('deny_by_default', $config)) {
              $denyByDefault = (bool)$config['deny_by_default'];
              unset($config['deny_by_default']);
          }
  
          // By default, create an open ACL
          $acl = new AclAuthorization;
          $acl->addRole('guest');
          $acl->allow();
  
          $grant = 'deny';
          if ($denyByDefault) {
              $acl->deny('guest', null, null);
              $grant = 'allow';
          }
  
          if (! empty($config)) {
              return self::injectGrants($acl, $grant, $config);
          }
  
          return $acl;
      }
code: public static function factory(array $config)
      {
          // Determine whether we are whitelisting or blacklisting
          $denyByDefault = false;
          if (array_key_exists('deny_by_default', $config)) {
              $denyByDefault = (bool)$config['deny_by_default'];
              unset($config['deny_by_default']);
          }
  
          // By default, create an open ACL
          $acl = new AclAuthorization;
          $acl->addRole('guest');
          $acl->allow();
  
          $grant = 'deny';
          if ($denyByDefault) {
              $acl->deny('guest', null, null);
              $grant = 'allow';
          }
  
          if (! empty($config)) {
              return self::injectGrants($acl, $grant, $config);
          }
  
          return $acl;
      }
code_tokens: public static function factory ( array $ config ) { // Determine whether we are whitelisting or blacklisting $ denyByDefault = false ; if ( array_key_exists ( 'deny_by_default' , $ config ) ) { $ denyByDefault = ( bool ) $ config [ 'deny_by_default' ] ; unset ( $ config [ 'deny_by_default' ] ) ; } // By default, create an open ACL $ acl = new AclAuthorization ; $ acl -> addRole ( 'guest' ) ; $ acl -> allow ( ) ; $ grant = 'deny' ; if ( $ denyByDefault ) { $ acl -> deny ( 'guest' , null , null ) ; $ grant = 'allow' ; } if ( ! empty ( $ config ) ) { return self :: injectGrants ( $ acl , $ grant , $ config ) ; } return $ acl ; }
docstring: Create and return an AclAuthorization instance populated with provided privileges.
  
  @param array $config
  @return AclAuthorization
docstring_tokens: Create and return an AclAuthorization instance populated with provided privileges .