PluginProbe
Boxzilla – WordPress Popup Builder / 3.2.21
Boxzilla – WordPress Popup Builder v3.2.21
3.4.11 3.4.10 3.4.9 3.4.3 3.4.4 3.4.5 3.4.6 3.4.7 3.4.8 trunk 3.0 3.0.1 3.0.2 3.0.3 3.1 3.1.1 3.1.10 3.1.11 3.1.12 3.1.13 3.1.14 3.1.15 3.1.16 3.1.17 3.1.18 All 72 releases
← All changes | src/di/class-container.php +19 -5 trunk3.2.21 View file →
@@ -1,8 +1,8 @@
1 1 <?php
2 2 // phpcs:ignoreFile
3 3 /*
4 - * This is a modified version of Pimple, a dependency injection container for PHP originally developed by Fabien Potencier.
4 + * This file is part of Pimple.
5 5 *
6 6 * Copyright (c) 2009 Fabien Potencier
7 7 *
8 8 * Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -68,9 +68,8 @@
68 68 * @param string $id The unique identifier for the parameter or object
69 69 * @param mixed $value The value of the parameter or a closure to define an object
70 70 * @throws \RuntimeException Prevent override of a frozen service
71 71 */
72 - #[\ReturnTypeWillChange]
73 72 public function offsetSet( $id, $value ) {
74 73 if ( isset( $this->frozen[ $id ] ) ) {
75 74 throw new \RuntimeException( sprintf( 'Cannot override frozen service "%s".', $id ) );
76 75 }
@@ -87,9 +86,8 @@
87 86 * @return mixed The value of the parameter or an object
88 87 *
89 88 * @throws \InvalidArgumentException if the identifier is not defined
90 89 */
91 - #[\ReturnTypeWillChange]
92 90 public function offsetGet( $id ) {
93 91 if ( ! isset( $this->keys[ $id ] ) ) {
94 92 throw new \InvalidArgumentException( sprintf( 'Identifier "%s" is not defined.', $id ) );
95 93 }
@@ -122,9 +120,8 @@
122 120 * @param string $id The unique identifier for the parameter or object
123 121 *
124 122 * @return bool
125 123 */
126 - #[\ReturnTypeWillChange]
127 124 public function offsetExists( $id ) {
128 125 return isset( $this->keys[ $id ] );
129 126 }
130 127
@@ -132,9 +129,8 @@
132 129 * Unsets a parameter or an object.
133 130 *
134 131 * @param string $id The unique identifier for the parameter or object
135 132 */
136 - #[\ReturnTypeWillChange]
137 133 public function offsetUnset( $id ) {
138 134 if ( isset( $this->keys[ $id ] ) ) {
139 135 if ( is_object( $this->values[ $id ] ) ) {
140 136 unset( $this->factories[ $this->values[ $id ] ], $this->protected[ $this->values[ $id ] ] );
@@ -251,6 +247,24 @@
251 247 * @return array An array of value names
252 248 */
253 249 public function keys() {
254 250 return array_keys( $this->values );
251 + }
252 +
253 + /**
254 + * Registers a service provider.
255 + *
256 + * @param ServiceProviderInterface $provider A ServiceProviderInterface instance
257 + * @param array $values An array of values that customizes the provider
258 + *
259 + * @return static
260 + */
261 + public function register( ServiceProviderInterface $provider, array $values = array() ) {
262 + $provider->register( $this );
263 +
264 + foreach ( $values as $key => $value ) {
265 + $this[ $key ] = $value;
266 + }
267 +
268 + return $this;
255 269 }
256 270 }