public function _buildDescription($startIndex = 0)
{
$times = $this->times();
$report = $this->_report;
$reference = $report['message']->reference();
$expected = $report['message']->name();
$with = $report['message']->args();
$expectedTimes = $times ? ' the expected times' : '';
$expectedParameters = $with ? ' with expected parameters' : '';
$this->_description['description'] = "receive the expected method{$expectedParameters}{$expectedTimes}.";
$calledTimes = count($report['args']);
if (!$calledTimes) {
$logged = [];
foreach (Calls::logs($reference, $startIndex) as $log) {
$logged[] = $log['static'] ? '::' . $log['name'] : $log['name'];
}
$this->_description['data']['actual received calls'] = $logged;
} elseif ($calledTimes) {
$this->_description['data']['actual received'] = $expected;
$this->_description['data']['actual received times'] = $calledTimes;
if ($with !== null) {
$this->_description['data']['actual received parameters list'] = $report['args'];
}
}
$this->_description['data']['expected to receive'] = $expected;
if ($with !== null) {
$this->_description['data']['expected parameters'] = $with;
}
if ($times) {
$this->_description['data']['expected received times'] = $times;
}
}