public static function newFromHeaders($headers) {
    $acl = new ACL();

    // READ rules.
    $rules = array();
    if (!empty($headers[self::HEADER_READ])) {
      $read = $headers[self::HEADER_READ];
      $rules = explode(',', $read);
      foreach ($rules as $rule) {
        $ruleArray = self::parseRule(self::READ, $rule);
        if (!empty($ruleArray)) {
          $acl->rules[] = $ruleArray;
        }
      }
    }

    // WRITE rules.
    $rules = array();
    if (!empty($headers[self::HEADER_WRITE])) {
      $write = $headers[self::HEADER_WRITE];
      $rules = explode(',', $write);
      foreach ($rules as $rule) {
        $ruleArray = self::parseRule(self::WRITE, $rule);
        if (!empty($ruleArray)) {
          $acl->rules[] = $ruleArray;
        }
      }
    }

    //throw new \Exception(print_r($acl->rules(), TRUE));

    return $acl;
  }
public static function newFromHeaders($headers) {
    $acl = new ACL();

    // READ rules.
    $rules = array();
    if (!empty($headers[self::HEADER_READ])) {
      $read = $headers[self::HEADER_READ];
      $rules = explode(',', $read);
      foreach ($rules as $rule) {
        $ruleArray = self::parseRule(self::READ, $rule);
        if (!empty($ruleArray)) {
          $acl->rules[] = $ruleArray;
        }
      }
    }

    // WRITE rules.
    $rules = array();
    if (!empty($headers[self::HEADER_WRITE])) {
      $write = $headers[self::HEADER_WRITE];
      $rules = explode(',', $write);
      foreach ($rules as $rule) {
        $ruleArray = self::parseRule(self::WRITE, $rule);
        if (!empty($ruleArray)) {
          $acl->rules[] = $ruleArray;
        }
      }
    }

    //throw new \Exception(print_r($acl->rules(), TRUE));

    return $acl;
  }
public static function newFromHeaders ( $ headers ) { $ acl = new ACL ( ) ; // READ rules. $ rules = array ( ) ; if ( ! empty ( $ headers [ self :: HEADER_READ ] ) ) { $ read = $ headers [ self :: HEADER_READ ] ; $ rules = explode ( ',' , $ read ) ; foreach ( $ rules as $ rule ) { $ ruleArray = self :: parseRule ( self :: READ , $ rule ) ; if ( ! empty ( $ ruleArray ) ) { $ acl -> rules [ ] = $ ruleArray ; } } } // WRITE rules. $ rules = array ( ) ; if ( ! empty ( $ headers [ self :: HEADER_WRITE ] ) ) { $ write = $ headers [ self :: HEADER_WRITE ] ; $ rules = explode ( ',' , $ write ) ; foreach ( $ rules as $ rule ) { $ ruleArray = self :: parseRule ( self :: WRITE , $ rule ) ; if ( ! empty ( $ ruleArray ) ) { $ acl -> rules [ ] = $ ruleArray ; } } } //throw new \Exception(print_r($acl->rules(), TRUE)); return $ acl ; }
Given a list of headers, get the ACL info.

This is a utility for processing headers and discovering any ACLs embedded
inside the headers.

@param array $headers
An associative array of headers.
@retval HPCloud::Storage::ObjectStorage::ACL
@return \HPCloud\Storage\ObjectStorage\ACL
A new ACL.
Given a list of headers get the ACL info .