Skip to content

Commit

Permalink
fix: fix conflict with Divi's ET_Core_Data_Utils class.
Browse files Browse the repository at this point in the history
  • Loading branch information
lots0logs committed Dec 1, 2021
1 parent 2595f70 commit c8fe746
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Utilities that make reading and writing PHP code more convenient and enjoyable",
"type": "library",
"license": "GPL-v2-or-later",
"version": "1.2.1",
"version": "1.2.2",
"authors": [
{
"name": "Elegant Themes",
Expand Down
4 changes: 2 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions src/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,20 @@ public function _arraySortByCallback( $a, $b ): int {
return 0;
}

public function __call( $name, $args ) {
$class = __CLASS__;

if ( method_exists( $this, $name ) ) {
throw new \Exception( "Call to protected or private method: {$class}::{$name}() from out of scope!" );
}

if ( method_exists( 'ET_Core_Data_Utils', $name ) ) {
return ET_Core_Data_Utils::instance()->$name( ...$args );
}

throw new \Exception( "Call to undefined method: {$class}::{$name}()" );
}

/**
* Returns `true` if all values in `$array` are not empty, `false` otherwise.
* If `$callback` is provided then values are passed to it instead of {@see empty()} (it should return a booleon value).
Expand Down

0 comments on commit c8fe746

Please sign in to comment.