| @@ 57-63 (lines=7) @@ | ||
| 54 | ||
| 55 | public function put($key, $value) |
|
| 56 | { |
|
| 57 | if (! $this->checkKeyType($key)) { |
|
| 58 | throw new \InvalidArgumentException( |
|
| 59 | 'The key provided for ' . get_class($this) |
|
| 60 | . '::put is not a valid type,' |
|
| 61 | . ' expected ' . $this->getKeyType() . '.' |
|
| 62 | ); |
|
| 63 | } |
|
| 64 | if (! $this->checkValueType($value)) { |
|
| 65 | throw new \InvalidArgumentException( |
|
| 66 | 'The value provided for ' . get_class($this) |
|
| @@ 64-70 (lines=7) @@ | ||
| 61 | . ' expected ' . $this->getKeyType() . '.' |
|
| 62 | ); |
|
| 63 | } |
|
| 64 | if (! $this->checkValueType($value)) { |
|
| 65 | throw new \InvalidArgumentException( |
|
| 66 | 'The value provided for ' . get_class($this) |
|
| 67 | . '::put is not a valid type,' |
|
| 68 | . ' expected ' . $this->getValueType() . '.' |
|
| 69 | ); |
|
| 70 | } |
|
| 71 | $previous = $this->get($key); |
|
| 72 | $this->data[$key] = $value; |
|
| 73 | return $previous; |
|