public function isAccepted($value, $var = null)
    {
        if ($this->getContentInstance() instanceof ContentSet) {
            if (!($value instanceof AbstractClassContent)) {
                // ContentSet accepts only AbstractClassContent elements
                return false;
            }

            if (in_array('!' . $this->_getType($value), $this->_accept)) {
                // ContentSet can exclude content types
                return false;
            }

            $acceptArray = array_filter($this->_accept, function($item) { return '!' !== substr($item, 0, 1); });
        } else {
            if (null === $var) {
                return false;
            }

            if (!array_key_exists($var, $this->_accept)) {
                return true;
            }

            $acceptArray = $this->_accept[$var];
        }

        if (0 === count($acceptArray)) {
            return true;
        }

        return in_array($this->_getType($value), $acceptArray);
    }
public function isAccepted($value, $var = null)
    {
        if ($this->getContentInstance() instanceof ContentSet) {
            if (!($value instanceof AbstractClassContent)) {
                // ContentSet accepts only AbstractClassContent elements
                return false;
            }

            if (in_array('!' . $this->_getType($value), $this->_accept)) {
                // ContentSet can exclude content types
                return false;
            }

            $acceptArray = array_filter($this->_accept, function($item) { return '!' !== substr($item, 0, 1); });
        } else {
            if (null === $var) {
                return false;
            }

            if (!array_key_exists($var, $this->_accept)) {
                return true;
            }

            $acceptArray = $this->_accept[$var];
        }

        if (0 === count($acceptArray)) {
            return true;
        }

        return in_array($this->_getType($value), $acceptArray);
    }
public function isAccepted ( $ value , $ var = null ) { if ( $ this -> getContentInstance ( ) instanceof ContentSet ) { if ( ! ( $ value instanceof AbstractClassContent ) ) { // ContentSet accepts only AbstractClassContent elements return false ; } if ( in_array ( '!' . $ this -> _getType ( $ value ) , $ this -> _accept ) ) { // ContentSet can exclude content types return false ; } $ acceptArray = array_filter ( $ this -> _accept , function ( $ item ) { return '!' !== substr ( $ item , 0 , 1 ) ; } ) ; } else { if ( null === $ var ) { return false ; } if ( ! array_key_exists ( $ var , $ this -> _accept ) ) { return true ; } $ acceptArray = $ this -> _accept [ $ var ] ; } if ( 0 === count ( $ acceptArray ) ) { return true ; } return in_array ( $ this -> _getType ( $ value ) , $ acceptArray ) ; }
Checks for an accepted type.

@param mixed  $value the value from which the type will be checked
@param string $var   the element to be checks

@return Boolean
Checks for an accepted type .