Exemple #1
0
 /**
  * {@inheritdoc}
  */
 public function __set($property, $value)
 {
     switch ($property) {
         case 'userModel':
         case 'loginRoute':
         case 'unauthorizedRoute':
         case 'ajaxRoute':
         case 'createSessions':
         case 'createCookies':
         case 'sessionPrefix':
         case 'sessionLifeTime':
         case 'sessionRenewAfter':
         case 'cookiePrefix':
         case 'cookieLifeTime':
         case 'cookieRenewAfter':
         case 'permissionPrefix':
             $this->{$property} = $value;
             return;
         case 'passwordHasher':
             if ($value instanceof PasswordHasher) {
                 $this->passwordHasher = $value;
             } else {
                 Assume::isSubclassOf($value, 'Jivoo\\AccessControl\\Passwordhasher');
                 $this->passwordHasher = new $value();
             }
             return;
         case 'authentication':
             if (is_array($value)) {
                 foreach ($value as $name => $options) {
                     if (!is_string($name)) {
                         $name = $options;
                         $options = array();
                     }
                     $this->loadAuthentication($name, $options);
                 }
             } else {
                 $this->loadAuthentication($value);
             }
             return;
         case 'authorization':
             if (is_array($value)) {
                 foreach ($value as $name => $options) {
                     if (!is_string($name)) {
                         $name = $options;
                         $options = array();
                     }
                     $this->loadAuthorization($name, $options);
                 }
             } else {
                 $this->loadAuthorization($value);
             }
             return;
         case 'acl':
             if (is_array($value)) {
                 foreach ($value as $name => $options) {
                     if (!is_string($name)) {
                         $name = $options;
                         $options = array();
                     }
                     $this->loadAcl($name, $options);
                 }
             } else {
                 $this->loadAcl($value);
             }
             return;
     }
     parent::__set($property, $value);
 }