PluginProbe
Media Cloud Sync / 1.4.1
Media Cloud Sync v1.4.1
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 1.2.9 All 35 releases
← All changes | includes/sdk/google/google/gax/src/ArrayTrait.php +9 -9 1.2.31.4.1 View file →
@@ -29,9 +29,9 @@
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;
33 +namespace Dudlewebs\WPMCS\GCP\Google\ApiCore;
34 34
35 35 /**
36 36 * Provides basic array helper methods.
37 37 *
@@ -49,9 +49,9 @@
49 49 * @throws \InvalidArgumentException
50 50 */
51 51 private function pluck(string $key, array &$arr, bool $isRequired = \true)
52 52 {
53 - if (!array_key_exists($key, $arr)) {
53 + if (!\array_key_exists($key, $arr)) {
54 54 if ($isRequired) {
55 55 throw new \InvalidArgumentException("Key {$key} does not exist in the provided array.");
56 56 }
57 57 return null;
@@ -70,9 +70,9 @@
70 70 private function pluckArray(array $keys, array &$arr)
71 71 {
72 72 $values = [];
73 73 foreach ($keys as $key) {
74 - if (array_key_exists($key, $arr)) {
74 + if (\array_key_exists($key, $arr)) {
75 75 $values[$key] = $this->pluck($key, $arr, \false);
76 76 }
77 77 }
78 78 return $values;
@@ -84,9 +84,9 @@
84 84 * @return bool
85 85 */
86 86 private function isAssoc(array $arr)
87 87 {
88 - return array_keys($arr) !== range(0, count($arr) - 1);
88 + return \array_keys($arr) !== \range(0, \count($arr) - 1);
89 89 }
90 90 /**
91 91 * Just like array_filter(), but preserves falsey values except null.
92 92 *
@@ -94,10 +94,10 @@
94 94 * @return array
95 95 */
96 96 private function arrayFilterRemoveNull(array $arr)
97 97 {
98 - return array_filter($arr, function ($element) {
99 - if (!is_null($element)) {
98 + return \array_filter($arr, function ($element) {
99 + if (!\is_null($element)) {
100 100 return \true;
101 101 }
102 102 return \false;
103 103 });
@@ -110,9 +110,9 @@
110 110 * @return array
111 111 */
112 112 private function subsetArray(array $keys, array $arr)
113 113 {
114 - return array_intersect_key($arr, array_flip($keys));
114 + return \array_intersect_key($arr, \array_flip($keys));
115 115 }
116 116 /**
117 117 * A method, similar to PHP's `array_merge_recursive`, with two differences.
118 118 *
@@ -126,10 +126,10 @@
126 126 */
127 127 private function arrayMergeRecursive(array $array1, array $array2)
128 128 {
129 129 foreach ($array2 as $key => $value) {
130 - if (array_key_exists($key, $array1) && is_array($array1[$key]) && is_array($value)) {
131 - $array1[$key] = $this->isAssoc($array1[$key]) && $this->isAssoc($value) ? $this->arrayMergeRecursive($array1[$key], $value) : array_merge($array1[$key], $value);
130 + if (\array_key_exists($key, $array1) && \is_array($array1[$key]) && \is_array($value)) {
131 + $array1[$key] = $this->isAssoc($array1[$key]) && $this->isAssoc($value) ? $this->arrayMergeRecursive($array1[$key], $value) : \array_merge($array1[$key], $value);
132 132 } else {
133 133 $array1[$key] = $value;
134 134 }
135 135 }