Skip to main content

Object

docs-source

Object trait is located in eightshift Libs. To extend it, use eightshift_Libs\Helpers\Object_Helper class.

All of us have some custom helpers and stuff that we use around on multiple the project. We have created this simple trait helper that you can use in any PHP class as a trait.

is_valid_xml​

Check if the provided XML is valid. It uses a DOMDocument library.

  • @param xml $xml Full xml document.
  • @return boolean

is_json​

Check if provided JSON is valid.

  • @param string $string String to check.
  • @return bool

flatten_array​

Flattens a multidimensional array.

  • @param array $array Multidimensional array.
  • @return array

sanitize_array​

Sanitize all the values in an array.

sort_array_by_order_key​

Sort array by order key. It is used to sort terms.

  • @param array $items Items array to sort. Must have order key.
  • @return array