Flow\JSONPath\AccessHelper::arrayValues PHP Method

arrayValues() public static method

public static arrayValues ( $collection )
    public static function arrayValues($collection)
    {
        if (is_array($collection)) {
            return array_values($collection);
        } else {
            if (is_object($collection)) {
                return array_values((array) $collection);
            }
        }
        throw new JSONPathException("Invalid variable type for arrayValues");
    }

Usage Example

Esempio n. 1
0
 /**
  * @param array $collection
  * @return array
  */
 public function filter($collection)
 {
     if (AccessHelper::keyExists($collection, $this->token->value, $this->magicIsAllowed)) {
         return array(AccessHelper::getValue($collection, $this->token->value, $this->magicIsAllowed));
     } else {
         if ($this->token->value === "*") {
             return AccessHelper::arrayValues($collection);
         }
     }
     return array();
 }
All Usage Examples Of Flow\JSONPath\AccessHelper::arrayValues