@param $materials

@return ListMaterialItem[]
549043
private function fetchItems($materials)
    {
        $list = [];
        /** @var MaterialInterface $material */
        foreach ($materials as $material) {
            $unitName = null;
            $unit = $material->getUnit();
            if (!is_null($unit)) {
                $unitName = $unit->getName();
            }

            $list[] = new ListMaterialItem(
                $material->getId(),
                $material->getName(),
                $material->getCode(),
                $unitName,
                $material->getCategory()->getName()
            );
        }

        return $list;
    }
255448
protected function getArrayableItems($items)
	{
		if ($items instanceof Collection)
		{
			$items = $items->all();
		}
		elseif ($items instanceof Arrayable)
		{
			$items = $items->toArray();
		}

		return $items;
	}
900010
protected function getArrayItems($items)
    {
        if (is_array($items)) {
            return $items;
        } elseif ($items instanceof self) {
            return $items->all();
        }

        return (array) $items;
    }
549993
public function get_resources() {

        // The containers should be ordered in the array after their elements.
        // Lineitems should be after lineitem.
        if (empty($this->resources)) {
            $this->resources = array();
            $this->resources[] = new lineitem($this);
            $this->resources[] = new lineitems($this);
            $this->resources[] = new results($this);
            $this->resources[] = new scores($this);
        }

        return $this->resources;
    }
278104
public static function order($items) {
		if (empty($items)) {
			return array();
		}

		$_items = array_combine(array_keys($items), Hash::extract($items, '{s}.weight'));
		asort($_items);

		foreach (array_keys($_items) as $key) {
			$_items[$key] = $items[$key];
		}

		return $items;
	}
147051
protected function getArrayableItems($items)
    {
        if (is_array($items)) {
            return $items;
        }
        if ($items instanceof self) {
            return $items->all();
        }
        if (is_object($items) && method_exists($items, 'toArray')) {
            return $items->toArray();
        }
        if (is_object($items) && method_exists($items, 'toJson')) {
            return json_decode($items->toJson(), true);
        }
        if ($items instanceof JsonSerializable) {
            return $items->jsonSerialize();
        }
        if ($items instanceof Traversable) {
            return iterator_to_array($items);
        }

        return (array) $items;
    }
391619
public function getMaterialList($data)
    {
        $result = $this->httpRaw(self::WECHAT_MATERIAL_LIST_GET_PREFIX, $data, [
            'access_token' => $this->getAccessToken()
        ]);
        return !isset($result['errodcode']) ? $result : false;
    }
762889
protected function getItems( $items )
	{
		if (is_array($items))
		{
			return $items;
		}
		if($items instanceof self)
		{
			return $items->getAll();
		}
		if($items instanceof Arrayable)
		{
			return $items->toArray();
		}
		if($items instanceof Jsonable)
		{
			return json_decode($items->toJson(), true);
		}
		if($items instanceof JsonSerializable)
		{
			return $items->jsonSerialize();
		}
		if($items instanceof Traversable)
		{
			return iterator_to_array($items);
		}

		return (array) $items;
	}
1002130
public function process(array $items)
    {
        foreach ($items as $key => $item) {
            $items[$key] = $this->doClean($item);
        }

        return $items;
    }
194530
def ids(self):
        """"""
        assert self.name == "Materials"
        ids = list()
        for attr in self.attrs:
            attr_obj = getattr(self, attr)
            if hasattr(attr_obj, 'Id'):
                ids.append(getattr(attr_obj, 'Id'))
        return ids
805661
protected function parseItems($items)
    {
        $items = $items instanceof Traversable ? $items->toArray() : $items;

        return array_map(function ($item) {
            return $item instanceof ScanEntity ? $item : new ScanEntity($item);
        }, $items);
    }
8227
public function filter(array $items): array
    {
        foreach ($this->filter as $filter) {
            $items = $filter->filter($items);
        }

        return $items;
    }
326269
private List<ScmMaterialConfig> filterScmMaterials() {
        List<ScmMaterialConfig> scmMaterials = new ArrayList<>();
        for (MaterialConfig material : this) {
            if (material instanceof ScmMaterialConfig) {
                scmMaterials.add((ScmMaterialConfig) material);
            }
        }
        return scmMaterials;
    }
205507
public static function toCollections(array $items): array
    {
        foreach ($items as $k => $item) {
            $items[$k] = new static($item);
        }

        return $items;
    }
1137458
public function setItems($items)
    {
        $orderItems = [];
        foreach ($items as $item) {
            if (is_array($item)) {
                $orderItems[] = new Item($item);
            } elseif (! ($item instanceof Item)) {
                throw new \InvalidArgumentException('Item should be an instance of ' . Item::class);
            }
        }

        return parent::setItems($orderItems);
    }
79832
protected function itemsToValues(IItems $items)
    {
        $values = [];
        foreach ($items as $item) {
            /** @var IItem $item */
            $valueId    = $item->get('id');
            $parsedItem = $item->parseValue();

            $values[$valueId] = \array_merge(
                [self::SELECT_RAW => $parsedItem['raw']],
                $parsedItem['text']
            );
        }

        return $values;
    }
317460
public function filter(array $items): array
    {
        $filtered = [];
        foreach ($items as $commandName => $commandDefinition) {
            if ($commandName === static::EXCLUDED) {
                continue;
            }

            $isExcluded = true;

            if ($this->shouldCommandBeAdded($commandName, $commandDefinition)) {
                $isExcluded = false;
            }

            $commandDefinition[static::EXCLUDED] = $isExcluded;
            $filtered[$commandName] = $commandDefinition;
        }

        return $filtered;
    }