Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

Commit 5c10b75

Browse files
author
Mike Willbanks
committed

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

src/Header/Accept.php

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
*/
1919
class Accept extends AbstractAccept
2020
{
21+
/**
22+
* @var string
23+
*/
2124
protected $regexAddType = '#^([a-zA-Z+-]+|\*)/(\*|[a-zA-Z0-9+-]+)$#';
2225

2326
/**
@@ -67,9 +70,9 @@ public function hasMediaType($type)
6770
/**
6871
* Parse the keys contained in the header line
6972
*
70-
* @param string $fieldValuePart
71-
* @return \Zend\Http\Header\Accept\FieldValuePart\CharsetFieldValuePart
72-
* @see \Zend\Http\Header\AbstractAccept::parseFieldValuePart()
73+
* @param string $fieldValuePart
74+
* @return FieldValuePart\AcceptFieldValuePart
75+
* @see \Zend\Http\Header\AbstractAccept::parseFieldValuePart()
7376
*/
7477
protected function parseFieldValuePart($fieldValuePart)
7578
{
@@ -87,7 +90,7 @@ protected function parseFieldValuePart($fieldValuePart)
8790
}
8891

8992
if ($pos = strpos($fieldValuePart, '/')) {
90-
$subtypeWhole = $format = $subtype = trim(substr($fieldValuePart, strpos($fieldValuePart, '/')+1));
93+
$subtypeWhole = $format = $subtype = trim(substr($fieldValuePart, strpos($fieldValuePart, '/') + 1));
9194
} else {
9295
$subtypeWhole = '';
9396
$format = '*';
@@ -96,19 +99,19 @@ protected function parseFieldValuePart($fieldValuePart)
9699

97100
$pos = strpos($subtype, '+');
98101
if (false !== $pos) {
99-
$format = trim(substr($subtype, $pos+1));
102+
$format = trim(substr($subtype, $pos + 1));
100103
$subtype = trim(substr($subtype, 0, $pos));
101104
}
102105

103106
$aggregated = array(
104-
'typeString' => trim($fieldValuePart),
105-
'type' => $type,
106-
'subtype' => $subtype,
107-
'subtypeRaw' => $subtypeWhole,
108-
'format' => $format,
109-
'priority' => isset($params['q']) ? $params['q'] : 1,
110-
'params' => $params,
111-
'raw' => trim($raw)
107+
'typeString' => trim($fieldValuePart),
108+
'type' => $type,
109+
'subtype' => $subtype,
110+
'subtypeRaw' => $subtypeWhole,
111+
'format' => $format,
112+
'priority' => isset($params['q']) ? $params['q'] : 1,
113+
'params' => $params,
114+
'raw' => trim($raw),
112115
);
113116

114117
return new FieldValuePart\AcceptFieldValuePart((object) $aggregated);

0 commit comments

Comments
 (0)