public function checkModifierFunctions(array $array, $parent, $parentKey = null)
    {
        foreach($array as $k => $v)
        {
            // You can have recursive modifiers so we check if the value is an array.
            if(is_array($v))
            {
                // Check config
                // Valid configs can be top level modifiers and their attributes inside - you can have a top level modifier
                // inside a top level modifier - that's why we also check \Tripod\Mongo\Composites\Tables::$predicatesModifiers direct
                if(!array_key_exists($k, $parent) && !array_key_exists($k, \Tripod\Mongo\Composites\Tables::$predicateModifiers))
                {
                    throw new \Tripod\Exceptions\ConfigException("Invalid modifier: '".$k."' in key '".$parentKey."'");
                }

                // If this config value is a top level modifier, use that as the parent so that we can check the attributes
                if(array_key_exists($k, \Tripod\Mongo\Composites\Tables::$predicateModifiers))
                {
                    $this->checkModifierFunctions($v, \Tripod\Mongo\Composites\Tables::$predicateModifiers[$k], $k);
                } else
                {
                    $this->checkModifierFunctions($v, $parent[$k], $k);
                }

            } else if(is_string($k))
            {
                // Check key
                if(!array_key_exists($k, $parent))
                {
                    throw new \Tripod\Exceptions\ConfigException("Invalid modifier: '".$k."' in key '".$parentKey."'");
                }
            }
        }
    }
public function checkModifierFunctions(array $array, $parent, $parentKey = null)
    {
        foreach($array as $k => $v)
        {
            // You can have recursive modifiers so we check if the value is an array.
            if(is_array($v))
            {
                // Check config
                // Valid configs can be top level modifiers and their attributes inside - you can have a top level modifier
                // inside a top level modifier - that's why we also check \Tripod\Mongo\Composites\Tables::$predicatesModifiers direct
                if(!array_key_exists($k, $parent) && !array_key_exists($k, \Tripod\Mongo\Composites\Tables::$predicateModifiers))
                {
                    throw new \Tripod\Exceptions\ConfigException("Invalid modifier: '".$k."' in key '".$parentKey."'");
                }

                // If this config value is a top level modifier, use that as the parent so that we can check the attributes
                if(array_key_exists($k, \Tripod\Mongo\Composites\Tables::$predicateModifiers))
                {
                    $this->checkModifierFunctions($v, \Tripod\Mongo\Composites\Tables::$predicateModifiers[$k], $k);
                } else
                {
                    $this->checkModifierFunctions($v, $parent[$k], $k);
                }

            } else if(is_string($k))
            {
                // Check key
                if(!array_key_exists($k, $parent))
                {
                    throw new \Tripod\Exceptions\ConfigException("Invalid modifier: '".$k."' in key '".$parentKey."'");
                }
            }
        }
    }
public function checkModifierFunctions ( array $ array , $ parent , $ parentKey = null ) { foreach ( $ array as $ k => $ v ) { // You can have recursive modifiers so we check if the value is an array. if ( is_array ( $ v ) ) { // Check config // Valid configs can be top level modifiers and their attributes inside - you can have a top level modifier // inside a top level modifier - that's why we also check \Tripod\Mongo\Composites\Tables::$predicatesModifiers direct if ( ! array_key_exists ( $ k , $ parent ) && ! array_key_exists ( $ k , \ Tripod \ Mongo \ Composites \ Tables :: $ predicateModifiers ) ) { throw new \ Tripod \ Exceptions \ ConfigException ( "Invalid modifier: '" . $ k . "' in key '" . $ parentKey . "'" ) ; } // If this config value is a top level modifier, use that as the parent so that we can check the attributes if ( array_key_exists ( $ k , \ Tripod \ Mongo \ Composites \ Tables :: $ predicateModifiers ) ) { $ this -> checkModifierFunctions ( $ v , \ Tripod \ Mongo \ Composites \ Tables :: $ predicateModifiers [ $ k ] , $ k ) ; } else { $ this -> checkModifierFunctions ( $ v , $ parent [ $ k ] , $ k ) ; } } else if ( is_string ( $ k ) ) { // Check key if ( ! array_key_exists ( $ k , $ parent ) ) { throw new \ Tripod \ Exceptions \ ConfigException ( "Invalid modifier: '" . $ k . "' in key '" . $ parentKey . "'" ) ; } } } }
Check modifier functions against fields
@param array $array
@param mixed $parent
@param string|null $parentKey
@throws \Tripod\Exceptions\ConfigException
Check modifier functions against fields