runWhen() public méthode

Handle a "when" step.
public runWhen ( &$world, string $action, array $arguments ) : mixed
$action string The description of the step.
$arguments array Additional arguments to the step.
Résultat mixed The outcome of the step.
Exemple #1
0
 /**
  * Handle a "when" step.
  *
  * @param array  &$world    Joined "world" of variables.
  * @param string $action    The description of the step.
  * @param array  $arguments Additional arguments to the step.
  *
  * @return mixed The outcome of the step.
  */
 public function runWhen(&$world, $action, $arguments)
 {
     switch ($action) {
         case 'create a Kolab default calendar with name':
             $folder = $world['storage']->getNewFolder();
             $folder->setName($arguments[0]);
             $world['folder_creation'] = $folder->save(array('type' => 'event', 'default' => true));
             $folder->setACL(Auth::getAuth(), 'alrid');
             break;
         case 'allow a group full access to a folder':
             $folder = $world['storage']->getFolder($arguments[1]);
             $folder->setACL($arguments[0], 'alrid');
             break;
         case 'retrieving the list of shares for the application':
             $shares = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Share')->create($arguments[0], 'kolab');
             $world['list'] = $shares->listShares(Auth::getAuth());
             break;
         case 'logging in as a user with a password':
             $world['login'] = $world['auth']->authenticate($arguments[0], array('password' => $arguments[1]));
             $world['storage'] = $this->prepareEmptyKolabStorage();
             return parent::runWhen($world, $action, $arguments);
         default:
             return parent::runWhen($world, $action, $arguments);
     }
 }