Returns the contained array and applies the optional $codeBlock to each element before returning it.

@param callable $codeBlock

@return array
553115
public function get(callable $codeBlock = null)
    {
        if (is_callable($codeBlock)) {
            return array_map($codeBlock, $this->values);
        } else {
            return $this->values;
        }
    }
1330855
public function getValidBlockItems(Block $block)
    {
        $dbHandler = $this->getConnection();
        $q = $dbHandler->createSelectQuery();
        $q
            ->select('object_id, ezm_pool.node_id, ezm_pool.priority, ts_publication, ts_visible, rotation_until, moved_to')
            ->from($dbHandler->quoteTable('ezm_pool'))
            ->innerJoin(
                $dbHandler->quoteTable('ezcontentobject_tree'),
                $q->expr->eq('ezcontentobject_tree.node_id', 'ezm_pool.node_id')
            )
            ->where(
                $q->expr->eq('block_id', $q->bindValue($block->id)),
                $q->expr->gt('ts_visible', $q->bindValue(0, null, PDO::PARAM_INT)),
                $q->expr->eq('ts_hidden', $q->bindValue(0, null, PDO::PARAM_INT))
            )
            ->orderBy('priority', SelectQuery::DESC);

        $stmt = $q->prepare();
        $stmt->execute();
        $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
        $items = array();
        foreach ($rows as $row) {
            $items[] = $this->buildBlockItem(
                $row + array(
                    'block_id' => $block->id,
                    'ts_hidden' => 0,
                )
            );
        }

        return $items;
    }
109650
private function availableUserBlocks(): Collection
    {
        return $this->module_service->findByInterface(ModuleBlockInterface::class, false, true)
            ->filter(static function (ModuleBlockInterface $block): bool {
                return $block->isUserBlock();
            })
            ->mapWithKeys(static function (ModuleInterface $block): array {
                return [$block->name() => $block];
            });
    }
1367819
protected function getCustomSortingList() : array
    {
        $arEventResult = Event::fire('shopaholic.promo_block.sorting.get.list', [$this->sValue]);
        if (empty($arEventResult)) {
            return [];
        }

        $arElementIDList = [];
        foreach ($arEventResult as $arEventPromoBlockIDList) {
            if (empty($arEventPromoBlockIDList) || !is_array($arEventPromoBlockIDList)) {
                continue;
            }

            $arElementIDList = $arEventPromoBlockIDList;
            break;
        }

        return $arElementIDList;
    }
756965
public function getUseDeclarations() {
    $declarations = [];
    /** @var \Pharborist\Namespaces\UseDeclarationBlockNode[] $use_blocks */
    $use_blocks = $this->children(Filter::isInstanceOf('\Pharborist\Namespaces\UseDeclarationBlockNode'));
    foreach ($use_blocks as $use_block) {
      foreach ($use_block->getDeclarationStatements() as $use_statement) {
        $declarations = array_merge($declarations, $use_statement->getDeclarations()->toArray());
      }
    }
    return new NodeCollection($declarations, FALSE);
  }
679843
public function includeBlockabale(Block $block)
    {
        $blockable = $block->blockable;
        if (!empty($blockable)) {
            $entityClassName  = (new ReflectionClass($blockable))->getShortName();
            $transformerClass = 'Gzero\\Api\\Transformer\\' . $entityClassName . 'Transformer';
            return $this->item($blockable, new $transformerClass());
        }
        return null;
    }
621549
public function blockFencedCodeComplete($block)
    {
        $text = print_r($block, true);
        
        $matches = array();
        preg_match('/\[class\] => language-([a-zA-Z]+)/', $text, $matches);
        
        if (count($matches) > 1 && $matches[1] === 'shell') {
            $block['element']['text']['text'] = $this->minimalHighlighter->highlight($block['element']['text']['text']);
        }
        else {
            $block['element']['text']['text'] = $this->highlighter->highlight($block['element']['text']['text']);
        }

        return $block;
    }
178179
private function availableTreeBlocks(): Collection
    {
        return $this->module_service->findByInterface(ModuleBlockInterface::class, false, true)
            ->filter(static function (ModuleBlockInterface $block): bool {
                return $block->isTreeBlock();
            })
            ->mapWithKeys(static function (ModuleInterface $block): array {
                return [$block->name() => $block];
            });
    }
753756
private static function getBlocksWithStart(array $serializedBlocks): array
    {
        $blocksWithStart = BlockSerializer::unserializeBlocksWithStart($serializedBlocks);

        // check result contain only block indexes and the blocks are procedures
        assert(
            is_array($blocks = static::getBlocks($serializedBlocks)) &&
            static::debugCheckBlocksExist($blocksWithStart, $blocks, BlockSerializer::TYPE__PROCEDURE)
        );

        return $blocksWithStart;
    }
1362802
public function getBlockEndToken(): array
    {
        if (!$this->hasDocBlock()) {
            throw new DomainException(
                sprintf('Missing doc block for position %s of file %s.', $this->stackPos, $this->file->getFilename())
            );
        }

        return $this->tokens[$this->getBlockEndPosition()];
    }
445014
public static function matrixFieldsOfType(MatrixBlock $matrixBlock, string $fieldType): array
    {
        $foundFields = [];

        try {
            $matrixBlockTypeModel = $matrixBlock->getType();
        } catch (InvalidConfigException $e) {
            $matrixBlockTypeModel = null;
        }
        if ($matrixBlockTypeModel) {
            $fields = $matrixBlockTypeModel->getFields();
            /** @var  $field BaseField */
            foreach ($fields as $field) {
                if ($field instanceof $fieldType) {
                    $foundFields[] = $field->handle;
                }
            }
        }

        return $foundFields;
    }
863890
public function getContainerByCode($code)
    {
        $block = null;

        foreach ($this->getBlocks() as $blockTmp) {
            if (\in_array($blockTmp->getType(), ['sonata.page.block.container', 'sonata.block.service.container'], true) && $blockTmp->getSetting('code') === $code) {
                $block = $blockTmp;

                break;
            }
        }

        return $block;
    }
1240198
public function getListEmployees($includeBlock = true) {
		$fields = [
			$this->alias . '.id',
			$this->alias . '.' . $this->displayField,
		];
		$conditions = [];
		$blockExists = $this->hasField('block');
		if (!$includeBlock && $blockExists) {
			$conditions[$this->alias . '.block'] = false;
		}
		$order = $this->getOrderFiled();
		$this->recursive = -1;

		return $this->find('list', compact('fields', 'conditions', 'order'));
	}
735962
public function getAllBlockNames()
    {
        $ret = [ ];
        try {
            $result = $this->getSoapClient()->GetBlockNames();
        } catch ( SoapException $ex ) {
            throw new StatusException('Error while getting the list of all blocks in the active template' , $ex);
        }
        if ( isset($result->GetBlockNamesResult->string) ) {
            if ( is_array($result->GetBlockNamesResult->string) ) {
                $ret = $result->GetBlockNamesResult->string;
            } else {
                $ret[] = $result->GetBlockNamesResult->string;
            }
        }

        return $ret;
    }
1080622
public function loadChildBlocksData(Block $block, ?string $placeholder = null): array
    {
        $query = $this->getBlockSelectQuery();
        $query->where(
            $query->expr()->eq('b.parent_id', ':parent_id')
        )
        ->setParameter('parent_id', $block->id, Type::INTEGER)
        ->addOrderBy('b.placeholder', 'ASC')
        ->addOrderBy('b.position', 'ASC');

        if ($placeholder !== null) {
            $query->andWhere(
                $query->expr()->eq('b.placeholder', ':placeholder')
            )
            ->setParameter('placeholder', $placeholder, Type::STRING);
        }

        $this->applyStatusCondition($query, $block->status, 'b.status');

        return $query->execute()->fetchAll(PDO::FETCH_ASSOC);
    }
906357
public function getCacheTags(ReadBlockInterface $block)
    {
        return array(
            $this->tagManager->formatContentTypeTag($block->getAttribute('contentTypeId')),
            $this->tagManager->formatContentIdTag($block->getAttribute('contentId'))
        );
    }
1219059
protected function createBlocks(BlockInterface $block)
    {
        $content = [];
        $content['id'] = $block->getId();
        $content['name'] = $block->getName();
        $content['enabled'] = $block->getEnabled();
        $content['position'] = $block->getPosition();
        $content['settings'] = $block->getSettings();
        $content['type'] = $block->getType();
        $content['created_at'] = $block->getCreatedAt()->format('U');
        $content['updated_at'] = $block->getUpdatedAt()->format('U');
        $content['blocks'] = [];

        foreach ($block->getChildren() as $child) {
            $content['blocks'][] = $this->createBlocks($child);
        }

        return $content;
    }