/**
  * @param string $mobile
  */
 public function setMobile($mobile)
 {
     $this->mobile->set($mobile);
 }
 /**
  * @param Attribute $registeredAddress
  * @return OrganizationalPerson
  */
 public function setRegisteredAddress($registeredAddress)
 {
     $this->registeredAddress->set($registeredAddress);
     return $this;
 }
 /**
  * @param Attribute $email
  * @return CloudService
  */
 public function setEmail($email)
 {
     $this->mail->set($email);
     return $this;
 }
 public function addObject($class, $ldapArray = [])
 {
     $object = new $class();
     $reflectionObject = new \ReflectionObject($object);
     do {
         foreach ($reflectionObject->getProperties() as $reflectionProperty) {
             $annotation = AnnotationHelper::getReader()->getPropertyAnnotation($reflectionProperty, Mapper\Attribute::class);
             if ($annotation instanceof Mapper\Attribute) {
                 $name = strtolower(isset($annotation->name) ? $annotation->name : $reflectionProperty->name);
                 if ($this->attributes->containsKey($name)) {
                     $reflectionProperty->setAccessible(true);
                     $reflectionProperty->setValue($object, $this->attributes[$name]);
                     continue;
                 }
                 $attribute = null;
                 switch ($annotation->type) {
                     case 'string':
                     case 'number':
                         if (isset($ldapArray[$name])) {
                             if ($this->attributes->containsKey($name)) {
                                 $attribute = $this->attributes[$name];
                             } else {
                                 if (is_array($ldapArray[$name])) {
                                     $value = isset($ldapArray[$name][0]) ? $ldapArray[$name][0] : null;
                                 } else {
                                     $value = $ldapArray[$name];
                                 }
                                 $attribute = new Attribute();
                                 $attribute->set($value);
                             }
                         } else {
                             $attribute = new Attribute();
                         }
                         break;
                     case 'array':
                         if (isset($ldapArray[$name])) {
                             if (!is_array($ldapArray[$name])) {
                                 $values = array($ldapArray[$name]);
                             } else {
                                 $values = [];
                                 foreach ($ldapArray[$name] as $key => $value) {
                                     if ($key === 'count') {
                                         continue;
                                     }
                                     $values[] = new Attribute($value);
                                 }
                             }
                             $attribute = new ArrayCollection($values);
                         } else {
                             $attribute = new ArrayCollection();
                         }
                         break;
                     case 'bool':
                     case 'boolean':
                         if (isset($ldapArray[$name])) {
                             if ($this->attributes->containsKey($name)) {
                                 $attribute = $this->attributes[$name];
                             } else {
                                 if (is_array($ldapArray[$name])) {
                                     $value = isset($ldapArray[$name][0]) ? $ldapArray[$name][0] : null;
                                 } else {
                                     $value = $ldapArray[$name];
                                 }
                                 $attribute = new Attribute();
                                 $attribute->set($value);
                             }
                         } else {
                             $attribute = new Attribute("FALSE");
                         }
                         break;
                     default:
                         throw new \InvalidArgumentException('Invalid Attribute Type :' . $annotation->type);
                 }
                 $this->attributes[$name] = $attribute;
                 $reflectionProperty->setAccessible(true);
                 $reflectionProperty->setValue($object, $attribute);
             }
         }
     } while ($reflectionObject = $reflectionObject->getParentClass());
     $this->objects[] = $object;
     $this->afterAddObject($class);
 }
 /**
  * @param Attribute $gpgPublicKey
  * @return LenticularUser
  */
 public function setGpgPublicKey($gpgPublicKey)
 {
     $this->gpgPublicKey->set($gpgPublicKey);
     return $this;
 }
 /**
  * @param Attribute $displayName
  * @return SambaSamAccount
  */
 public function setDisplayName($displayName)
 {
     $this->displayName->set($displayName);
     return $this;
 }
 /**
  * @param mixed $gecos
  * @return PosixAccount
  */
 public function setGecos($gecos)
 {
     $this->gecos->get($gecos);
     return $this;
 }
 /**
  * @param mixed $cn
  * @return Person
  */
 public function setCn($cn)
 {
     $this->cn->set($cn);
     return $this;
 }
 /**
  * @param $cn
  */
 public function setCn($cn)
 {
     $this->cn->set($cn);
 }
 /**
  * @param string $shadowExpire
  * @return ShadowAccount
  */
 public function setShadowExpire($shadowExpire)
 {
     $this->shadowExpire->set($shadowExpire);
     return $this;
 }
Esempio n. 11
0
 /**
  * @param string $authLabel
  * @return CloudService
  */
 public function setAuthLabel($authLabel)
 {
     $this->authLabel->set($authLabel);
     return $this;
 }
 /**
  * @param Attribute $authRole
  * @return LenticularUser
  */
 public function removeAuthRole($authRole)
 {
     foreach ($this->authRoles as $authRole) {
         if ($authRole->get() == $authRole) {
             $this->authRoles->remove($authRole);
         }
     }
     return $this;
 }