Flow\JSONPath\AccessHelper::collectionKeys PHP Method

collectionKeys() public static method

public static collectionKeys ( $collection )
    public static function collectionKeys($collection)
    {
        if (is_object($collection)) {
            return array_keys(get_object_vars($collection));
        } else {
            return array_keys($collection);
        }
    }

Usage Example

Example #1
0
 /**
  * Evaluate an expression and return the last key
  * @return mixed
  */
 public function lastKey()
 {
     $keys = AccessHelper::collectionKeys($this->data);
     if (empty($keys) || end($keys) === false) {
         return null;
     }
     return end($keys);
 }