for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace BenatEspina\StackExchangeApiClient\Application\Service\Answer;
/**
* Answers of ids command.
*
* @author Beñat Espiña <[email protected]>
*/
class AnswersOfIdsCommand
{
const URL = '/answers/%s';
* The API URL.
* @var string
private $url;
* Array that contains StackExchange API params.
* @var array
private $params;
* Constructor.
* @param array|string $id The answer id. Also, it can be multiple ids separated by semicolon.
* @param array $params Array that contains StackExchange API params
public function __construct($id, array $params = ['site' => 'stackoverflow'])
if (empty($params)) {
$params = [
'order' => 'desc',
'sort' => 'activity',
'site' => 'stackoverflow',
];
}
$this->params = $params;
$this->url = sprintf(self::URL, is_array($id) ? implode(';', $id) : $id);
* @return string
public function url()
return $this->url;
* Gets the params.
* @return array
public function params()
return $this->params;