Last active
May 26, 2017 15:03
-
-
Save anthonybudd/5ea5f3901c2d18d9668e8946c857259e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| Abstract Class WP_Model implements JsonSerializable{ | |
| ... | |
| public function isFilterProperty($attribute){ | |
| return ( | |
| ( | |
| isset($this->filter) && | |
| in_array($attribute, $this->filter) && | |
| method_exists($this, ('_filter'. ucfirst($attribute))) | |
| ) || ( | |
| count(array_filter(array_keys($this->filter), 'is_string')) > 0 && | |
| isset($this->filter) && | |
| in_array($attribute, array_keys($this->filter)) && | |
| isset($this->filter[$attribute]) && | |
| function_exists($this->filter[$attribute]) | |
| ) | |
| ); | |
| } | |
| public function getFilterProperty($attribute){ | |
| if( count(array_filter(array_keys($this->filter), 'is_string')) > 0 && | |
| isset($this->filter[$attribute]) && | |
| function_exists($this->filter[$attribute])) { | |
| return ($this->filter[$attribute]($this->get($attribute))); | |
| } | |
| return call_user_func_array([$this, ('_filter'. ucfirst($attribute))], [$this->get($attribute)]); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment