PHP Classes

File: src/Filters/AbstractFilter.php

Recommend this page to a friend!
  Classes of Sascha Greuel   PHP JSON Path   src/Filters/AbstractFilter.php   Download  
File: src/Filters/AbstractFilter.php
Role: Class source
Content type: text/plain
Description: Class source
Class: PHP JSON Path
Query values from data structures like XPATH
Author: By
Last change:
Date: 3 years ago
Size: 788 bytes
 

Contents

Class file image Download
<?php

/**
 * JSONPath implementation for PHP.
 *
 * @license https://github.com/SoftCreatR/JSONPath/blob/main/LICENSE MIT License
 */

declare(strict_types=1);

namespace
Flow\JSONPath\Filters;

use
ArrayAccess;
use
Flow\JSONPath\{JSONPath, JSONPathToken};

abstract class
AbstractFilter
{
   
/**
     * @var JSONPathToken
     */
   
protected $token;

   
/**
     * @var bool
     */
   
protected $magicIsAllowed = false;

   
/**
     * @param int|bool $options
     */
   
public function __construct(JSONPathToken $token, $options = false)
    {
       
$this->token = $token;
       
$this->magicIsAllowed = (bool)($options & JSONPath::ALLOW_MAGIC);
    }

   
/**
     * @param array|ArrayAccess $collection
     */
   
abstract public function filter($collection): array;
}