Get all of the invoie items by a given type.

@param  string $type

@return array
541020
public function invoiceItemsByType($type)
    {
        $lineItems = [];

        if (isset($this->lines->data)) {
            foreach ($this->lines->data as $line) {
                if ($line->type == $type) {
                    $lineItems[] = new InvoiceItem($this->user, $line);
                }
            }
        }

        return $lineItems;
    }
700277
public function get_type( $type ) {
		$tokens = [];

		foreach ( $this->text as $index => $token ) {
			if ( $token->type === $type ) {
				$tokens[ $index ] = $token;
			}
		}

		return $tokens;
	}
1110867
public function resources(String $type = null)
    {
        return [
            'resources' => collect(Storage::files($this->uploadFolder))
                ->filter(function ($file) {
                    return !str_is("{$this->uploadFolder}.*", $file);
                })
                ->map(function ($file) {
                    $fileParts = pathinfo($file);

                    return [
                        'public_id' => array_get($fileParts, 'filename'),
                        'format' => array_get($fileParts, 'extension'),
                    ];
                })->all()
            ];
    }
261665
public function getForm($type)
    {
        $arguments = array();
        switch (strtolower($type)) {
            case 'config':
                $class = 'Config';
                $arguments[] = $this->getService();
                break;
            case 'advanced':
                $class = 'AdvancedConfig';
                $arguments[] = $this->getService();
                break;
            case 'batch':
                $class = 'Batch';
                $arguments[] = $this->getInvoiceManager();
                break;
            case 'invoice':
                $class = 'InvoiceStatusOverview';
                $arguments[] = $this->getInvoiceManager();
                $arguments[] = $this->getAcumulusEntryManager();
                $arguments[] = $this->getService();
                break;
            default;
                throw new \InvalidArgumentException("Unknown form type $type");
        }
        $arguments = array_merge($arguments, array(
            $this->getFormHelper(),
            $this->getShopCapabilities(),
            $this->getConfig(),
            $this->getTranslator(),
            $this->getLog(),
        ));
        /** @noinspection PhpIncompatibleReturnTypeInspection */
        return $this->getInstance($class . 'Form', 'Shop', $arguments);
    }
646322
public static function getSubTypeList($type) {
        if (empty(self::$_subTypes[$type])) {
            throw new InvalidArgumentException(sprintf('Sub-type %s does not exist', $type));
        }

        $types = array();

        foreach (self::$_subTypes[$type] as $ext) {
            $types[$ext] = self::getTypeFromExt($ext);
        }

        return $types;
    }
572565
private function resolveTypes($type)
    {
        $columnTypes = [];

        do {
            $columnTypes[] = $columnType = $this->columnRegistry[$type];
        } while (($type = $columnType->getParent()) !== null);

        return $columnTypes;
    }
1306494
public function lists($type = null)
    {
        $params = [
            'type' => $type,
        ];

        return $this->parseJSON('get', [self::API_LISTS, $params]);
    }
1210090
public function getFirstItem(...$types)
    {
        $items = $this->getItems(...$types);

        // If there are no matching items
        if (!count($items)) {
            throw new OutOfBoundsException(
                OutOfBoundsException::NO_MATCHING_ITEMS_STR,
                OutOfBoundsException::NO_MATCHING_ITEMS
            );
        }

        return $items[0];
    }
872724
protected function getResultsByType($type)
    {
        $instance = $this->createModelByType($type);

        $key = $instance->getKeyName();

        $query = $instance->newQuery();

        $query = $this->useWithTrashed($query);

        return $query->whereIn($key, $this->gatherKeysByType($type)->all())->get();
    }
206873
public function fetchAll($type = parent::FETCH_TYPE_NUM)
    {
        return array_map($this->_callback, $this->_statement->fetchAll($type));
    }
1236780
public static function getRequestParams($type = 'all')
    {
        $request = Yii::$app->getRequest();
        switch ($type) {
            case 'get':
                $params = $request->get();
                break;

            case 'post':
                $params = $request->post();
                break;

            case 'all':
            default:
                $params = ArrayHelper::merge($request->get(), $request->post());
                break;
        }

        return $params;
    }
241024
public function clear($type = null)
    {
        if (false === $this->mf->hasCache()) {
            return [];
        }
        return $this->doClear($this->getTypes($type));
    }
413949
protected function getType($type)
    {
        if (isset($this->typeAlias[$type])) {
            return $this->typeAlias[$type];
        }

        return $type;
    }
968314
public function gatherElementsFromType( $type )
	{
		if ( is_string( $type ) )
		{
			$type = $this->getType( $type );
		}

		if ( ! is_array( $type ) ) return false;

		$elements = array();

		foreach ( array( 'elements', 'sequence', 'choice', 'group' ) as $typeComponent )
		{
			if ( ! isset( $type[ $typeComponent ] ) )
			{
				continue;
			}

			foreach ( $type[ $typeComponent ] as $id => $element )
			{
				if ( $id == 'restrictionType')
				{
					continue;
				}

				if ( $id == 'elements' )
				{
					$elements += $element;
					continue;
				}

				$result = $this->gatherElementsFromType( $element );
				if ( ! $result )
				{
					$elements[ "{$element['prefix']}:{$element['name']}" ] = $element;
				}

				$elements += $result;
			}

		}

		return $elements;
	}
739018
public function getBusinessPropertiesByType($type)
    {
        $bp = [];

        if (isset($this->businessProperties[$type])) {
            $bp = $this->businessProperties[$type];
        }

        return $bp;
    }
550828
public function get($type = FALSE)
  {
    $result = $this->peek($type);
	
    $this->clear($type);
	
    return $result;
  }
591517
public function getTags(int $type = null): array
    {
        if ($type === null) {
            return $this->tags;
        }

        return array_filter($this->tags, function (Tag $tag) use ($type): bool {
            return $tag->getType() === $type;
        });
    }