/**
  * Transform to protection model.
  *
  * @param Entity $protection
  *
  * @return Config[]
  */
 public static function transform(Entity $protection)
 {
     $return = array();
     $path = sprintf(self::path, $protection->getDomain()->getPath(), $protection->getId());
     foreach ($protection->getProtectionuser() as $user) {
         /** @var EntityUser $user */
         $model = new Config();
         $model->setUsername($user->getUsername())->setPassword($user->getPassword())->setPath($path)->setId($user->getProtection()->getId());
         $return[] = $model;
     }
     return $return;
 }
Exemplo n.º 2
0
 /**
  * Test path getter / setter.
  */
 public function testPath()
 {
     $protection = new Protection();
     $protection->setPath('/var/www');
     $this->assertEquals('/var/www', $protection->getPath());
 }