attributeHasValue() public static method

Checks if the given value(s) exist in the attribute
public static attributeHasValue ( array &$data, string $attribName, mixed | array $value ) : boolean
$data array
$attribName string
$value mixed | array
return boolean
Beispiel #1
0
 /**
  * Checks if the given value(s) exist in the attribute
  *
  * @param  string      $attribName
  * @param  mixed|array $value
  * @return boolean
  */
 public function attributeHasValue($attribName, $value)
 {
     return Zend_Ldap_Attribute::attributeHasValue($this->_currentData, $attribName, $value);
 }
Beispiel #2
0
 public function testHasValue()
 {
     $data = array('strings1' => array('value1', 'value2', 'value2', 'value3'), 'strings2' => array('value1', 'value2', 'value3', 'value4'), 'boolean1' => array('TRUE', 'TRUE', 'TRUE', 'TRUE'), 'boolean2' => array('TRUE', 'FALSE', 'TRUE', 'FALSE'));
     $this->assertTrue(Zend_Ldap_Attribute::attributeHasValue($data, 'strings1', 'value1'));
     $this->assertFalse(Zend_Ldap_Attribute::attributeHasValue($data, 'strings1', 'value4'));
     $this->assertTrue(Zend_Ldap_Attribute::attributeHasValue($data, 'boolean1', true));
     $this->assertFalse(Zend_Ldap_Attribute::attributeHasValue($data, 'boolean1', false));
     $this->assertTrue(Zend_Ldap_Attribute::attributeHasValue($data, 'strings1', array('value1', 'value2')));
     $this->assertTrue(Zend_Ldap_Attribute::attributeHasValue($data, 'strings1', array('value1', 'value2', 'value3')));
     $this->assertFalse(Zend_Ldap_Attribute::attributeHasValue($data, 'strings1', array('value1', 'value2', 'value3', 'value4')));
     $this->assertTrue(Zend_Ldap_Attribute::attributeHasValue($data, 'strings2', array('value1', 'value2', 'value3', 'value4')));
     $this->assertTrue(Zend_Ldap_Attribute::attributeHasValue($data, 'boolean2', array(true, false)));
     $this->assertFalse(Zend_Ldap_Attribute::attributeHasValue($data, 'boolean1', array(true, false)));
 }