public function addRemote($name, $url, $options = array())
{
if (empty($name)) {
throw new GitException('Cannot add remote without a name.');
}
if (empty($url)) {
throw new GitException('Cannot add remote without a URL.');
}
$args = array('add');
// Add boolean options.
foreach (array('-f', '--tags', '--no-tags') as $option) {
if (!empty($options[$option])) {
$args[] = $option;
}
}
// Add tracking branches.
if (!empty($options['-t'])) {
foreach ($options['-t'] as $branch) {
array_push($args, '-t', $branch);
}
}
// Add master branch.
if (!empty($options['-m'])) {
array_push($args, '-m', $options['-m']);
}
// Add remote name and URL.
array_push($args, $name, $url);
return call_user_func_array(array($this, 'remote'), $args);
}