XBRL-Instance.php
public function ElementsByItemType( $types )
	{
		if ( is_string( $types ) )
			$types = array_map( 'trim', explode( ",", $types ) );

		if ( ! is_array( $types ) )
			throw new Exception( 'InstanceElementsFilter::ElementsByName $types must be a string or array' );

		$types = array_flip( array_map( 'strtolower', $types ) );

		// In PHP 7.0 $this is passed to closure functions automatically but not in earlier versions
		$elements = &$this->elements;

		$filtered = array_reduce( array_keys( $this->elements ), function( $carry, $elementName ) use( &$elements, $types  ) {

			$namespaceElements = array_filter( $elements[ $elementName ], function( $entry ) use( $types ) {
				$type = $entry['taxonomy_element']['type'];
				return isset( $types[ strtolower( $type ) ] );
			} );

			if ( ! $namespaceElements ) return $carry;

			$carry[ $elementName ] = $namespaceElements;

			return $carry;

		}, array() );

		return new InstanceElementsFilter( $this->instance, $filtered );
	}
public function ElementsByItemType( $types )
	{
		if ( is_string( $types ) )
			$types = array_map( 'trim', explode( ",", $types ) );

		if ( ! is_array( $types ) )
			throw new Exception( 'InstanceElementsFilter::ElementsByName $types must be a string or array' );

		$types = array_flip( array_map( 'strtolower', $types ) );

		// In PHP 7.0 $this is passed to closure functions automatically but not in earlier versions
		$elements = &$this->elements;

		$filtered = array_reduce( array_keys( $this->elements ), function( $carry, $elementName ) use( &$elements, $types  ) {

			$namespaceElements = array_filter( $elements[ $elementName ], function( $entry ) use( $types ) {
				$type = $entry['taxonomy_element']['type'];
				return isset( $types[ strtolower( $type ) ] );
			} );

			if ( ! $namespaceElements ) return $carry;

			$carry[ $elementName ] = $namespaceElements;

			return $carry;

		}, array() );

		return new InstanceElementsFilter( $this->instance, $filtered );
	}
public function ElementsByItemType ( $ types ) { if ( is_string ( $ types ) ) $ types = array_map ( 'trim' , explode ( "," , $ types ) ) ; if ( ! is_array ( $ types ) ) throw new Exception ( 'InstanceElementsFilter::ElementsByName $types must be a string or array' ) ; $ types = array_flip ( array_map ( 'strtolower' , $ types ) ) ; // In PHP 7.0 $this is passed to closure functions automatically but not in earlier versions
 $ elements = & $ this -> elements ; $ filtered = array_reduce ( array_keys ( $ this -> elements ) , function ( $ carry , $ elementName ) use ( & $ elements , $ types ) { $ namespaceElements = array_filter ( $ elements [ $ elementName ] , function ( $ entry ) use ( $ types ) { $ type = $ entry [ 'taxonomy_element' ] [ 'type' ] ; return isset ( $ types [ strtolower ( $ type ) ] ) ; } ) ; if ( ! $ namespaceElements ) return $ carry ; $ carry [ $ elementName ] = $ namespaceElements ; return $ carry ; } , array ( ) ) ; return new InstanceElementsFilter ( $ this -> instance , $ filtered ) ; }
Return a list of elements based on a set of item types
@param array|string $types The parameter can be the name of a item type, a comma delimited list of item types or an array of item types
@throws Exception
@return InstanceElementsFilter
Return a list of elements based on a set of item types