1<?php
2/**
3 * Zend Framework (http://framework.zend.com/)
4 *
5 * @link      http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license   http://framework.zend.com/license/new-bsd New BSD License
8 */
9
10namespace Zend\Http\Header\Accept\FieldValuePart;
11
12/**
13 * Field Value Part
14 *
15 *
16 * @see        http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1
17 */
18abstract class AbstractFieldValuePart
19{
20    /**
21     * Internal object used for value retrieval
22     * @var object
23     */
24    private $internalValues;
25
26    /**
27     * A Field Value Part this Field Value Part matched against.
28     * @var AbstractFieldValuePart
29     */
30    protected $matchedAgainst;
31
32    /**
33     *
34     * @param object $internalValues
35     */
36    public function __construct($internalValues)
37    {
38        $this->internalValues = $internalValues;
39    }
40
41    /**
42     * Set a Field Value Part this Field Value Part matched against.
43     *
44     * @param AbstractFieldValuePart $matchedAgainst
45     * @return AbstractFieldValuePart provides fluent interface
46     */
47    public function setMatchedAgainst(AbstractFieldValuePart $matchedAgainst)
48    {
49        $this->matchedAgainst = $matchedAgainst;
50        return $this;
51    }
52
53    /**
54     * Get a Field Value Part this Field Value Part matched against.
55     *
56     * @return AbstractFieldValuePart|null
57     */
58    public function getMatchedAgainst()
59    {
60        return $this->matchedAgainst;
61    }
62
63    /**
64     *
65     * @return object
66     */
67    protected function getInternalValues()
68    {
69        return $this->internalValues;
70    }
71
72    /**
73     * @return string $typeString
74     */
75    public function getTypeString()
76    {
77        return $this->getInternalValues()->typeString;
78    }
79
80    /**
81     * @return float $priority
82     */
83    public function getPriority()
84    {
85        return (float) $this->getInternalValues()->priority;
86    }
87
88    /**
89     * @return \stdClass $params
90     */
91    public function getParams()
92    {
93        return (object) $this->getInternalValues()->params;
94    }
95
96    /**
97     * @return string $raw
98     */
99    public function getRaw()
100    {
101        return $this->getInternalValues()->raw;
102    }
103
104    /**
105     *
106     * @param mixed
107     * @return mixed
108     */
109    public function __get($key)
110    {
111        return $this->getInternalValues()->$key;
112    }
113}
114