standardize EOLs to output diffs properly on Windows
[phpt.git] / src / PHPT / Section / POSTRAW.php
blob037289b5919f1b2ee84b22327f955c16f82ba67d
1 <?php
3 class PHPT_Section_POSTRAW extends PHPT_Section_POST
5 private $_content_type = null;
7 public function __construct($data = '')
9 $real_data = '';
10 $lines = explode(PHP_EOL, $data);
11 $started = false;
13 foreach ($lines as $line) {
14 if (preg_match('/^Content-Type:(.*)/i', $line, $matches)) {
15 $this->_content_type = trim($matches[1]);
16 continue;
19 if ($started) {
20 $real_data .= PHP_EOL;
22 $started = true;
23 $real_data .= $line;
25 parent::__construct($real_data);
28 public function modifyEnv(PHPT_Section_ENV $env)
30 parent::modifyEnv($env);
31 if (!is_null($this->_content_type)) {
32 $env->data['CONTENT_TYPE'] = $this->_content_type;