/** * Get specific errors list * * @param string $file * @param string $code * @param bool $returnLines * @return array * @throws \PHPUnit_Framework_Exception */ protected function getSpecificErrorsList($file, $code, $returnLines = false) { $errors = self::$model->getErrors(); if (!isset($errors[$file])) { throw new \PHPUnit_Framework_Exception('Errors for file ' . self::$fileTest . ' not found.'); } $errors = $errors[$file]; if (!isset($errors[$code])) { throw new \PHPUnit_Framework_Exception("Errors for code {$code} not found."); } $list = []; $key = $returnLines ? 'line' : 'value'; foreach ($errors[$code] as $item) { if ($key == 'value' && isset($item['line'])) { $list[$item['line']] = $item[$key]; } else { $list[] = $item[$key]; } } return $list; }
/** * Get specific errors list * * @param string $file * @param string $code * @return array * @throws \PHPUnit_Framework_Exception */ protected function getSpecificErrorsList($file, $code) { $errors = self::$model->getErrors(); if (!isset($errors[$file])) { throw new \PHPUnit_Framework_Exception('Errors for file ' . self::$classTest . ' not found.'); } $errors = $errors[$file]; if (!isset($errors[$code])) { throw new \PHPUnit_Framework_Exception("Errors for code {$code} not found."); } return $errors[$code]; }