public function parse(array $data, ParsingDispatcher $parsingDispatcher)
    {
        if (!array_key_exists('VisibilityCriterion', $data)) {
            throw new Exceptions\Parser('Invalid <VisibilityCriterion> format');
        }

        if ($data['VisibilityCriterion'] != VisibilityCriterion::VISIBLE && $data['VisibilityCriterion'] != VisibilityCriterion::HIDDEN) {
            throw new Exceptions\Parser('Invalid <VisibilityCriterion> format');
        }

        return new VisibilityCriterion((int)$data['VisibilityCriterion']);
    }
public function parse(array $data, ParsingDispatcher $parsingDispatcher)
    {
        if (!array_key_exists('VisibilityCriterion', $data)) {
            throw new Exceptions\Parser('Invalid <VisibilityCriterion> format');
        }

        if ($data['VisibilityCriterion'] != VisibilityCriterion::VISIBLE && $data['VisibilityCriterion'] != VisibilityCriterion::HIDDEN) {
            throw new Exceptions\Parser('Invalid <VisibilityCriterion> format');
        }

        return new VisibilityCriterion((int)$data['VisibilityCriterion']);
    }
public function parse ( array $ data , ParsingDispatcher $ parsingDispatcher ) { if ( ! array_key_exists ( 'VisibilityCriterion' , $ data ) ) { throw new Exceptions \ Parser ( 'Invalid <VisibilityCriterion> format' ) ; } if ( $ data [ 'VisibilityCriterion' ] != VisibilityCriterion :: VISIBLE && $ data [ 'VisibilityCriterion' ] != VisibilityCriterion :: HIDDEN ) { throw new Exceptions \ Parser ( 'Invalid <VisibilityCriterion> format' ) ; } return new VisibilityCriterion ( ( int ) $ data [ 'VisibilityCriterion' ] ) ; }
Parses input structure to a Visibility Criterion object.

@param array $data
@param \eZ\Publish\Core\REST\Common\Input\ParsingDispatcher $parsingDispatcher

@throws \eZ\Publish\Core\REST\Common\Exceptions\Parser

@return \eZ\Publish\API\Repository\Values\Content\Query\Criterion\Visibility
Parses input structure to a Visibility Criterion object .