/**
  * Adds a values
  *
  * @param  string $values
  * @return self
  */
 public function addValue($values)
 {
     if (!empty($values) && !$this->_values->contains($values)) {
         $this->_values->add($values);
     }
     return $this;
 }
 /**
  * Sets attribute sequence
  *
  * @param  array $attrs
  * @return self
  */
 public function setAttrs(array $attrs)
 {
     $this->_attrs = new Sequence();
     foreach ($attrs as $attr) {
         $attr = trim($attr);
         if (!$this->_attrs->contains($attr)) {
             $this->_attrs->add($attr);
         }
     }
     return $this;
 }
Exemplo n.º 3
0
 /**
  * Sets method sequence
  *
  * @param  array $methods
  * @return self
  */
 public function setMethods(array $methods)
 {
     $this->_methods = new Sequence();
     foreach ($methods as $value) {
         $value = trim($value);
         if (!$this->_methods->contains($value)) {
             $this->_methods->add($value);
         }
     }
     return $this;
 }
 /**
  * Sets token sequence
  *
  * @param  array  $tokens Tokens
  * @return self
  */
 public function setTokens(array $tokens)
 {
     $this->_tokens = new Sequence();
     foreach ($tokens as $token) {
         $token = trim($token);
         if (!empty($token) && !$this->_tokens->contains($token)) {
             $this->_tokens->add($token);
         }
     }
     if (count($this->_tokens) === 0) {
         throw new \InvalidArgumentException('RefreshRegisteredAuthTokens must have at least one token');
     }
     return $this;
 }
Exemplo n.º 5
0
 public function testContains()
 {
     $this->assertTrue($this->seq->contains(0));
     $this->assertTrue($this->seq->contains($this->a));
     $this->assertFalse($this->seq->contains(9999));
     $this->assertFalse($this->seq->contains(new stdClass()));
 }
Exemplo n.º 6
0
 /**
  * Constructor method for InviteTest
  * @param int $index
  * @param array $method
  * @param bool $negative
  * @return self
  */
 public function __construct($index, array $method = array(), $negative = null)
 {
     parent::__construct($index, $negative);
     $this->_method = new Sequence();
     foreach ($method as $value) {
         $value = trim($value);
         if (!$this->_method->contains($value)) {
             $this->_method->add($value);
         }
     }
     $this->on('before', function (FilterTest $sender) {
         if ($sender->method()->count()) {
             $sender->child('method', $sender->method()->all());
         }
     });
 }
Exemplo n.º 7
0
 /**
  * Constructor method for CheckPermission
  * @param  TargetSpec $target
  * @param  array $right
  * @return self
  */
 public function __construct(TargetSpec $target = null, array $right = array())
 {
     parent::__construct();
     if ($target instanceof TargetSpec) {
         $this->child('target', $target);
     }
     $this->_right = new Sequence();
     foreach ($right as $value) {
         $value = trim($value);
         if (!$this->_right->contains($value)) {
             $this->_right->add($value);
         }
     }
     $this->on('before', function (Base $sender) {
         if ($sender->right()->count()) {
             $sender->child('right', $sender->right()->all());
         }
     });
 }
 /**
  * Sets account sequence
  *
  * @param  array  $accounts Account
  * @return self
  */
 public function setAccounts(array $accounts)
 {
     $this->_accounts = new Sequence($accounts);
     foreach ($accounts as $dlm) {
         $dlm = trim($dlm);
         if (!empty($dlm) && !$this->_accounts->contains($dlm)) {
             $this->_accounts->add($dlm);
         }
     }
     return $this;
 }
Exemplo n.º 9
0
 /**
  * Set right sequence
  *
  * @param  array $rights
  * @return self
  */
 public function setRights(array $rights)
 {
     $this->_rights = new Sequence();
     foreach ($rights as $value) {
         $value = trim($value);
         if (!$this->_rights->contains($value)) {
             $this->_rights->add($value);
         }
     }
     return $this;
 }
 /**
  * Sets member sequence
  *
  * @param  array  $members Members
  * @return self
  */
 public function setMembers(array $members)
 {
     $this->_members = new Sequence($members);
     foreach ($members as $dlm) {
         $dlm = trim($dlm);
         if (!empty($dlm) && !$this->_members->contains($dlm)) {
             $this->_members->add($dlm);
         }
     }
     if (!count($this->_members)) {
         throw new \InvalidArgumentException('RemoveDistributionListMember must have at least a member');
     }
 }
 /**
  * Sets member sequence
  *
  * @param  array  $members Members
  * @return self
  */
 public function setMembers(array $members)
 {
     $this->_members = new Sequence();
     foreach ($members as $member) {
         $member = trim($member);
         if (!empty($member) && !$this->_members->contains($member)) {
             $this->_members->add($member);
         }
     }
     if (count($this->_members) === 0) {
         throw new \InvalidArgumentException('AddDistributionListMember must have at least one member');
     }
     return $this;
 }