|
| 1 | +<?php |
| 2 | + |
| 3 | +/** |
| 4 | + * Copyright 2015 Cloud Creativity Limited |
| 5 | + * |
| 6 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | + * you may not use this file except in compliance with the License. |
| 8 | + * You may obtain a copy of the License at |
| 9 | + * |
| 10 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + * |
| 12 | + * Unless required by applicable law or agreed to in writing, software |
| 13 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | + * See the License for the specific language governing permissions and |
| 16 | + * limitations under the License. |
| 17 | + */ |
| 18 | + |
| 19 | +namespace CloudCreativity\JsonApi\Contracts\Object; |
| 20 | + |
| 21 | +/** |
| 22 | + * Interface StandardObjectInterface |
| 23 | + * @package CloudCreativity\JsonApi |
| 24 | + */ |
| 25 | +interface StandardObjectInterface extends \Traversable, \Countable |
| 26 | +{ |
| 27 | + |
| 28 | + /** |
| 29 | + * @param $key |
| 30 | + * @param $default |
| 31 | + * @return mixed |
| 32 | + */ |
| 33 | + public function get($key, $default = null); |
| 34 | + |
| 35 | + /** |
| 36 | + * @param array $keys |
| 37 | + * @param $default |
| 38 | + * @return array |
| 39 | + */ |
| 40 | + public function getProperties(array $keys, $default = null); |
| 41 | + |
| 42 | + /** |
| 43 | + * @param $key |
| 44 | + * @param $value |
| 45 | + * @return $this |
| 46 | + */ |
| 47 | + public function set($key, $value); |
| 48 | + |
| 49 | + /** |
| 50 | + * @param array $values |
| 51 | + * @return $this |
| 52 | + */ |
| 53 | + public function setProperties(array $values); |
| 54 | + |
| 55 | + /** |
| 56 | + * @param $key |
| 57 | + * @return bool |
| 58 | + */ |
| 59 | + public function has($key); |
| 60 | + |
| 61 | + /** |
| 62 | + * Whether the object has all of the specified keys. |
| 63 | + * |
| 64 | + * @param array $keys |
| 65 | + * @return bool |
| 66 | + */ |
| 67 | + public function hasAll(array $keys); |
| 68 | + |
| 69 | + /** |
| 70 | + * Whether the object has any (at least one) of the specified keys. |
| 71 | + * |
| 72 | + * @param array $keys |
| 73 | + * @return bool |
| 74 | + */ |
| 75 | + public function hasAny(array $keys); |
| 76 | + |
| 77 | + /** |
| 78 | + * @param $key |
| 79 | + * @return $this |
| 80 | + */ |
| 81 | + public function remove($key); |
| 82 | + |
| 83 | + /** |
| 84 | + * @param array $keys |
| 85 | + * @return $this |
| 86 | + */ |
| 87 | + public function removeProperties(array $keys); |
| 88 | + |
| 89 | + /** |
| 90 | + * Reduce this object so that it only has the supplied allowed keys. |
| 91 | + * |
| 92 | + * @param array $keys |
| 93 | + * @return $this |
| 94 | + */ |
| 95 | + public function reduce(array $keys); |
| 96 | + |
| 97 | + /** |
| 98 | + * Get a list of the object's keys. |
| 99 | + * |
| 100 | + * @return string[] |
| 101 | + */ |
| 102 | + public function keys(); |
| 103 | + |
| 104 | + /** |
| 105 | + * Get the object's property values as an array. |
| 106 | + * |
| 107 | + * @return array |
| 108 | + */ |
| 109 | + public function toArray(); |
| 110 | +} |
0 commit comments