public static function factory (array $subfield)
    {
        if (!array_key_exists('code', $subfield)) {
            throw new InvalidArgumentException("Missing 'code' index in subfield array");
        }
        if (!array_key_exists('value', $subfield)) {
            throw new InvalidArgumentException("Missing 'value' index in subfield array");
        }
        return new Subfield($subfield['code'], $subfield['value']);
    }
public static function factory (array $subfield)
    {
        if (!array_key_exists('code', $subfield)) {
            throw new InvalidArgumentException("Missing 'code' index in subfield array");
        }
        if (!array_key_exists('value', $subfield)) {
            throw new InvalidArgumentException("Missing 'value' index in subfield array");
        }
        return new Subfield($subfield['code'], $subfield['value']);
    }
public static function factory ( array $ subfield ) { if ( ! array_key_exists ( 'code' , $ subfield ) ) { throw new InvalidArgumentException ( "Missing 'code' index in subfield array" ) ; } if ( ! array_key_exists ( 'value' , $ subfield ) ) { throw new InvalidArgumentException ( "Missing 'value' index in subfield array" ) ; } return new Subfield ( $ subfield [ 'code' ] , $ subfield [ 'value' ] ) ; }
Return a new subfield based on its array representation.

The array representation of a subfield is an associative array with the
keys `code' and `value', holding the subfield code and value.

@throws InvalidArgumentException Missing code or value index

@param  array $subfield Array representation of a subfield
@return Subfield New subfield
Return a new subfield based on its array representation .