| @@ 133-143 (lines=11) @@ | ||
| 130 | * |
|
| 131 | * @throws OutOfBoundsException If the primary key does not exist. |
|
| 132 | */ |
|
| 133 | public function getFirst($primaryKey) |
|
| 134 | { |
|
| 135 | if (!isset($this->values[$primaryKey])) { |
|
| 136 | throw new OutOfBoundsException(sprintf( |
|
| 137 | 'The key "%s" does not exist.', |
|
| 138 | $primaryKey |
|
| 139 | )); |
|
| 140 | } |
|
| 141 | ||
| 142 | return reset($this->values[$primaryKey]); |
|
| 143 | } |
|
| 144 | ||
| 145 | /** |
|
| 146 | * Returns the last value set for the given primary key. |
|
| @@ 154-164 (lines=11) @@ | ||
| 151 | * |
|
| 152 | * @throws OutOfBoundsException If the primary key does not exist. |
|
| 153 | */ |
|
| 154 | public function getLast($primaryKey) |
|
| 155 | { |
|
| 156 | if (!isset($this->values[$primaryKey])) { |
|
| 157 | throw new OutOfBoundsException(sprintf( |
|
| 158 | 'The key "%s" does not exist.', |
|
| 159 | $primaryKey |
|
| 160 | )); |
|
| 161 | } |
|
| 162 | ||
| 163 | return end($this->values[$primaryKey]); |
|
| 164 | } |
|
| 165 | ||
| 166 | /** |
|
| 167 | * Returns the number of secondary keys set for the given primary key. |
|
| @@ 175-185 (lines=11) @@ | ||
| 172 | * |
|
| 173 | * @throws OutOfBoundsException If the primary key does not exist. |
|
| 174 | */ |
|
| 175 | public function getCount($primaryKey) |
|
| 176 | { |
|
| 177 | if (!isset($this->values[$primaryKey])) { |
|
| 178 | throw new OutOfBoundsException(sprintf( |
|
| 179 | 'The key "%s" does not exist.', |
|
| 180 | $primaryKey |
|
| 181 | )); |
|
| 182 | } |
|
| 183 | ||
| 184 | return count($this->values[$primaryKey]); |
|
| 185 | } |
|
| 186 | ||
| 187 | /** |
|
| 188 | * Returns all values set for the given primary key. |
|
| @@ 196-206 (lines=11) @@ | ||
| 193 | * |
|
| 194 | * @throws OutOfBoundsException If the primary key does not exist. |
|
| 195 | */ |
|
| 196 | public function listByPrimaryKey($primaryKey) |
|
| 197 | { |
|
| 198 | if (!isset($this->values[$primaryKey])) { |
|
| 199 | throw new OutOfBoundsException(sprintf( |
|
| 200 | 'The key "%s" does not exist.', |
|
| 201 | $primaryKey |
|
| 202 | )); |
|
| 203 | } |
|
| 204 | ||
| 205 | return $this->values[$primaryKey]; |
|
| 206 | } |
|
| 207 | ||
| 208 | /** |
|
| 209 | * Returns all values set for the given secondary key. |
|