@param array $types
@param $section

@return ImageType[]
335305
public static function makeTypeChoices(array $types, $section)
    {
        $sectionTypes = [];

        foreach ($types as $type) {
            $sectionTypes[] = new ImageType($section, $type['code'], $type['label'], $type['filter']);
        }

        return $sectionTypes;
    }
1163178
private function extractTypeValues(array $columnList, array $types)
    {
        $typeValues = [];

        foreach ($columnList as $columnIndex => $columnName) {
            $typeValues[] = $types[$columnName] ?? ParameterType::STRING;
        }

        return $typeValues;
    }
1258450
public function createFilteringDrawer($section)
    {
        $this->filteringForm = Widget::Form(null, 'get', 'filtering');
        $this->createFilteringDuplicator($section);

        return $this->filteringForm;
    }
1313583
public function createFromArray(array $types)
    {
        foreach ($types as $type) {
            $this->collection->add(Type::fromString($type));
        }

        return $this->collection;
    }
765867
public function getFieldsWitTypes(array $types, $intersectArray = null)
    {
        $result = [];
        foreach ($this->getClassMetadata()->getFieldNames() as $field) {
            $type = $this->getClassMetadata()->getTypeOfField($field);
            if (in_array($type, $types)) {
                $result[] = $field;
            }
        }
        // calculate intersection
        if (!is_null($intersectArray)) {
            $result = array_intersect($result, $intersectArray);
        }

        return $result;
    }
1218209
public function getItems(...$types)
    {
        // If particular item types should be filtered
        if (count($types)) {
            return array_filter(
                $this->items,
                function (ItemInterface $item) use ($types) {
                    return $item->isOfType(...$types);
                }
            );
        }

        return $this->items;
    }
413390
protected function getSection(FieldTypeInterface $field, $section = null): SectionInterface
    {
        if (is_null($section)) {
            if ($this->repository->hasGroup($field->getOption('group'))) {
                $section = $this->repository->getGroup($field->getOption('group'));
            } else {
                $section = new Section($field->getOption('group'));
            }

            $section->addItem($field);
        }

        return $section;
    }
1316652
public static function guessClassFromTypes(array $types)
    {
        if (count($types)) {
            foreach (Resource::CLASSES as $class) {
                $class = "JSKOS\\$class";
                foreach ($class::TYPES as $uri) {
                    if (in_array($uri, $types)) {
                        return $class;
                    }
                }
            }
        }
    }
333595
public static function addSectionMediaElement($src, $type, PHPWord_Section_MemoryImage $memoryImage = null) {
		$mediaId = md5($src);
		$key = ($type == 'image') ? 'images' : 'embeddings';
		
		if(!array_key_exists($mediaId, self::$_sectionMedia[$key])) {
			$cImg = self::countSectionMediaElements('images');
			$cObj = self::countSectionMediaElements('embeddings');
			$rID = self::countSectionMediaElements() + 7;
			
			$media = array();
			
			if($type == 'image') {
				$cImg++;
				$inf = pathinfo($src);
				$isMemImage = (substr(strtolower($inf['extension']), 0, 3) == 'php' && $type == 'image') ? true : false;
				
				if($isMemImage) {
					$ext = $memoryImage->getImageExtension();
					$media['isMemImage'] = true;
					$media['createfunction'] = $memoryImage->getImageCreateFunction();
					$media['imagefunction'] = $memoryImage->getImageFunction();
				} else {
					$ext = $inf['extension'];
					if($ext == 'jpeg') { // Office crashes when adding a jpEg Image, so rename to jpg
						$ext = 'jpg';
					}
				}
				
				$folder = 'media';
				$file = $type.$cImg.'.'.strtolower($ext);
			} elseif($type == 'oleObject') {
				$cObj++;
				$folder = 'embedding';
				$file = $type.$cObj.'.bin';
			}
			
			$media['source'] = $src;
			$media['target'] = "$folder/section_$file";
			$media['type'] = $type;
			$media['rID'] = $rID;
			
			self::$_sectionMedia[$key][$mediaId] = $media;
			
			if($type == 'oleObject') {
				return array($rID, ++self::$_objectId);
			} else {
				return $rID;
			}
		} else {
			if($type == 'oleObject') {
				$rID = self::$_sectionMedia[$key][$mediaId]['rID'];
				return array($rID, ++self::$_objectId);
			} else {
				return self::$_sectionMedia[$key][$mediaId]['rID'];
			}
		}
	}
962639
protected function getSections($type = null)
    {
        if (!$type) {
            return $this->section;
        }
        $types = null;
        switch ($type) {
            case self::SECTION_ATTACHMENTS:
                $types = TypeAttachments::get();
                break;
            case self::SECTION_BODY:
                $types = TypeBody::get();
                break;
            default:
                throw new ImapClientException('Section type not recognised/supported');
                break;
        }
        $sections = array();
        foreach ($this->section as $section) {
            $obj = $this->getSectionStructure($section);
            if (!isset($obj->subtype)) {
                continue;
            }
            if (in_array($obj->subtype, $types, false)) {
                $sections[] = $section;
            }
        }

        return $sections;
    }
830284
private function processComponentSections($sections)
	{
		// var to hold output
		$output = array();

		// loop through each component grouping
		foreach ($sections as $component => $files)
		{
			// if we dont have an array for that component let's create it
			if (!isset($output[$component]))
			{
				$output[$component] = [];
			}

			// loop through each file
			foreach ($files as $file)
			{
				if (!preg_match('/(.*)v[0-9]+_[0-9]+.php$/', $file))
				{
					continue;
				}
				$output[$component] = array_merge($output[$component], $this->processFile($file));
			}
		}

		// return output
		return $output;
	}
24207
public function getCustomPaths( $section )
	{
		$paths = array();

		foreach ( $this->_manifests as $path => $manifest )
		{
			if ( isset( $manifest['custom'][$section] ) ) {
				$paths[$path] = $manifest['custom'][$section];
			}
		}

		return $paths;
	}
1358317
private function getSectionIds(array $sectionIdentifiers): array
    {
        $idList = [];

        foreach ($sectionIdentifiers as $identifier) {
            try {
                $section = $this->sectionHandler->loadByIdentifier($identifier);
                $idList[] = $section->id;
            } catch (NotFoundException $e) {
                continue;
            }
        }

        return $idList;
    }
875421
public function getSection($section)
    {
        if (!array_key_exists($section, $this->config)) {
            return null;
        }

        return $this->config[$section];
    }
282011
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 );
	}
1319024
protected function fetchAssets($templateContents, $section)
    {
        $pattern = sprintf('/BEGIN-%1$s[^\w\s]*[\r\n](.*?)[\r\n][^\w]*END-%1$s/s', $section);
        preg_match($pattern, $templateContents, $matches);
        
        return ( ! empty($matches)) ? explode("\n", $matches[1]) : array();
    }
1254838
public function getEntries( $section )
	{
		if( !isset( $this->list[$section] ) )
			throw new InvalidArgumentException( 'Invalid Section "'.$section.'".' );
		return array_values( $this->list[$section] );
	}