PluginProbe
Media Cloud Sync / 1.4.2
Media Cloud Sync v1.4.2
1.4.2 1.4.1 1.4.0 1.3.12 1.3.11 1.3.10 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.2.0 1.2.10 1.2.11 1.2.12 1.2.13 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 All 36 releases
← All changes | includes/sdk/google/google/gax/src/Options/OptionsTrait.php +12 -9 1.2.11 → 1.4.2 View file →
@@ -29,12 +29,12 @@
29 29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 32 */
33 -namespace Dudlewebs\WPMCS\Google\ApiCore\Options;
33 +namespace Dudlewebs\WPMCS\GCP\Google\ApiCore\Options;
34 34
35 -use Dudlewebs\WPMCS\Google\ApiCore\ValidationException;
36 35 use BadMethodCallException;
36 +use Dudlewebs\WPMCS\GCP\Google\ApiCore\ValidationException;
37 37 /**
38 38 * Trait implemented by any class representing an associative array of PHP options.
39 39 * This provides validation and typehinting to loosely typed associative arrays.
40 40 */
@@ -45,16 +45,19 @@
45 45 * @throws ValidationException
46 46 */
47 47 private static function validateFileExists(string $filePath)
48 48 {
49 - if (!file_exists($filePath)) {
49 + if (!\file_exists($filePath)) {
50 50 throw new ValidationException("Could not find specified file: {$filePath}");
51 51 }
52 52 }
53 - public function offsetExists($offset): bool
53 + public function offsetExists($offset) : bool
54 54 {
55 55 return isset($this->{$offset});
56 56 }
57 + /**
58 + * @return mixed
59 + */
57 60 #[\ReturnTypeWillChange]
58 61 public function offsetGet($offset)
59 62 {
60 63 return $this->{$offset};
@@ -61,9 +64,9 @@
61 64 }
62 65 /**
63 66 * @throws BadMethodCallException
64 67 */
65 - public function offsetSet($offset, $value): void
68 + public function offsetSet($offset, $value) : void
66 69 {
67 70 throw new BadMethodCallException('Cannot set options through array access. Use the setters instead');
68 71 }
69 72 /**
@@ -68,17 +71,17 @@
68 71 }
69 72 /**
70 73 * @throws BadMethodCallException
71 74 */
72 - public function offsetUnset($offset): void
75 + public function offsetUnset($offset) : void
73 76 {
74 77 throw new BadMethodCallException('Cannot unset options through array access. Use the setters instead');
75 78 }
76 - public function toArray(): array
79 + public function toArray() : array
77 80 {
78 81 $arr = [];
79 - foreach (get_object_vars($this) as $key => $value) {
80 - $arr[$key] = $value;
82 + foreach (\get_object_vars($this) as $key => $value) {
83 + $arr[$key] = $value instanceof OptionsInterface ? $value->toArray() : $value;
81 84 }
82 85 return $arr;
83 86 }
84 87 }