Skip to content

Commit

Permalink
can now get all agi arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelog committed Sep 4, 2012
1 parent 64e2889 commit 686e58e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
9 changes: 8 additions & 1 deletion src/mg/PAGI/ChannelVariables/IChannelVariables.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,13 @@ public function getTotalArguments();
*/
public function getArgument($index);

/**
* Returns all arguments as an array.
*
* @return string[]
*/
public function getArguments();

/**
* Returns the config directory for this running version of asterisk.
* Uses environment variable AST_CONFIG_DIR.
Expand Down Expand Up @@ -284,4 +291,4 @@ public function getDirectoryKey();
* @return string
*/
public function getDirectoryRun();
}
}
11 changes: 10 additions & 1 deletion src/mg/PAGI/ChannelVariables/Impl/ChannelVariablesFacade.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,15 @@ public function getArgument($index)
return false;
}

/**
* (non-PHPdoc)
* @see PAGI\ChannelVariables.IChannelVariables::getArguments()
*/
public function getArguments()
{
return $this->_arguments;
}

/**
* (non-PHPdoc)
* @see PAGI\ChannelVariables.IChannelVariables::getDirectoryConfig()
Expand Down Expand Up @@ -385,4 +394,4 @@ public function __construct(array $variables, array $arguments)
$this->_variables = $variables;
$this->_arguments = $arguments;
}
}
}
3 changes: 2 additions & 1 deletion test/channelvars/Test_ChannelVariables.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ public function can_get_agi_variables()
$this->assertEquals($vars->getTotalArguments(), 2);
$this->assertEquals($vars->getArgument(1), 'arg1');
$this->assertEquals($vars->getArgument(2), 'arg2');
$this->assertEquals(array(1 => 'arg1', 2 => 'arg2'), $vars->getArguments());
$this->assertFalse($vars->getArgument(3));
$refObject = new \ReflectionObject($vars);
$refMethod = $refObject->getMethod('getAGIVariable');
Expand Down Expand Up @@ -135,4 +136,4 @@ public function can_get_environment_variables()
$this->assertEquals($vars->getDirectoryConfig(), 1);
}
}
}
}

0 comments on commit 686e58e

Please sign in to comment.