protected function itemMatchesSelector($item, $selector)
    {
        // the selector is a simple path identifier
        // NOT something like key[*][subkey]
        if (strpos($selector, '*') === false) {
            return $item === $selector;
        }
        $regex = '/' . str_replace('*', '[^\]]+', str_replace(array(
            '[',
            ']'
        ), array(
            '\[',
            '\]'
        ), $selector)) . '/';
        return preg_match($regex, $item);
    }
protected function itemMatchesSelector($item, $selector)
    {
        // the selector is a simple path identifier
        // NOT something like key[*][subkey]
        if (strpos($selector, '*') === false) {
            return $item === $selector;
        }
        $regex = '/' . str_replace('*', '[^\]]+', str_replace(array(
            '[',
            ']'
        ), array(
            '\[',
            '\]'
        ), $selector)) . '/';
        return preg_match($regex, $item);
    }
protected function itemMatchesSelector ( $ item , $ selector ) { // the selector is a simple path identifier // NOT something like key[*][subkey] if ( strpos ( $ selector , '*' ) === false ) { return $ item === $ selector ; } $ regex = '/' . str_replace ( '*' , '[^\]]+' , str_replace ( array ( '[' , ']' ) , array ( '\[' , '\]' ) , $ selector ) ) . '/' ; return preg_match ( $ regex , $ item ) ; }
Checks if an item matches a selector

@example $this->('key[subkey]', 'key[*]') -> true;
$this->('key[subkey]', 'subkey') -> false;

@param string $item
@param string $selector
@return boolean number
Checks if an item matches a selector