PluginProbe
Elementor Website Builder – more than just a page builder / 3.1.0-dev2
Elementor Website Builder – more than just a page builder v3.1.0-dev2
4.3.4 4.3.3 4.3.2 4.3.1 4.3.0 4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 All 457 releases
← All changes | core/base/base-object.php +31 -0 3.1.0-dev1 → 3.1.0-dev2 View file →
@@ -79,8 +79,18 @@
79 79 $this->settings = [];
80 80 }
81 81 }
82 82
83 + final public function merge_properties( array $default_props, array $custom_props, array $allowed_props_keys = [] ) {
84 + $props = array_replace_recursive( $default_props, $custom_props );
85 +
86 + if ( $allowed_props_keys ) {
87 + $props = array_intersect_key( $props, array_flip( $allowed_props_keys ) );
88 + }
89 +
90 + return $props;
91 + }
92 +
83 93 /**
84 94 * Get items.
85 95 *
86 96 * Utility method that receives an array with a needle and returns all the
@@ -130,6 +140,27 @@
130 140 private function ensure_settings() {
131 141 if ( null === $this->settings ) {
132 142 $this->settings = $this->get_init_settings();
133 143 }
144 + }
145 +
146 + /**
147 + * Has Own Method
148 + *
149 + * Used for check whether the method passed as a parameter was declared in the current instance or inherited.
150 + *
151 + * @since 3.1.0
152 + *
153 + * @param string $method_name
154 + *
155 + * @throws \ReflectionException
156 + * @return bool True if the method was declared by the current instance, False if it was inherited.
157 + */
158 + public function has_own_method( $method_name ) {
159 + $reflection_method = new \ReflectionMethod( $this, $method_name );
160 +
161 + // If a ReflectionMethod is successfully created, get its declaring class.
162 + $declaring_class = $reflection_method->getDeclaringClass();
163 +
164 + return get_called_class() === $declaring_class->name;
134 165 }
135 166 }