From a list of category persistents to a list of id => name categories.

@param \tool_dataprivacy\category[] $categories
@param bool $includenotset
@param bool $includeinherit
@return string[]
168287
public static function category_options($categories, $includenotset = true, $includeinherit = true) {
        $options = self::base_options($includenotset, $includeinherit);
        foreach ($categories as $category) {
            $options[$category->get('id')] = $category->get('name');
        }

        return $options;
    }
440308
public function addCategorie(\Haven\CoreBundle\Entity\Category $categories)
    {
        $this->categories[] = $categories;
    
        return $this;
    }
132677
public function getCountryList($includeInternalCodes = false)
    {
        if ($this->countryList === null) {
            $this->countryList = require __DIR__ . '/../Resources/countries.php';
        }
        if ($this->countryExtraList === null) {
            $this->countryExtraList = require __DIR__ . '/../Resources/countries-extra.php';
        }

        if ($includeInternalCodes) {
            return array_merge($this->countryList, $this->countryExtraList);
        }

        return $this->countryList;
    }
54343
public function parseIncludes($includes)
    {
        $includes = $this->normalizeIncludesOrExcludes($includes);

        $this->includes = array_merge($this->includes, (array) $includes);

        return $this;
    }
1001785
public function all(bool $includeDeprecated = false): array {
        $result = [];
        foreach ($this->iterate($includeDeprecated) as $key => $value) {
            $result[$key] = $value;
        }
        return $result;
    }
1112591
private function formatCategories(array $categories) {

    $terms = [];

    foreach ($categories as $cid) {
      $term = $this->categoryRepo->loadCategoryTerm($cid);
      if ($term) {
        $terms[] = $term->id();
      }
    }

    return ($terms);
  }
1094581
protected function parseIncludes(array $includes)
    {
        $return = [
            'includes' => [],
            'modes' => []
        ];

        foreach ($includes as $include) {
            $explode = explode(':', $include);

            if (!isset($explode[1])) {
                $explode[1] = $this->defaults['mode'];
            }

            $return['includes'][] = $explode[0];
            $return['modes'][$explode[0]] = $explode[1];
        }

        return $return;
    }
1373395
public function getLinksArray($includeOnlyVisited = false){
        $links = $this->getLinks();
        
        if($includeOnlyVisited === true){
            $links = array_filter($links, function (Link $linkObj) {
                /*@var $linkObj Link */
                return $linkObj->isVisited() === true;
            });
        }
        
        return array_map(function(Link $link){
            return [
              'fullUrl' => $link->getAbsoluteUrl(),
              'uri' => $link->getPath(),
              'metaInfo' => $link->getMetaInfoArray(),
              'parentLink' => $link->getParentUrl(),
              'statusCode' => $link->getStatusCode(), 
              'status' => $link->getStatus(), 
              'contentType' => $link->getContentType(), 
              'errorInfo' => $link->getErrorInfo(),
              'crawlDepth' => $link->getCrawlDepth(),              
            ];
        },$links);
    }
1252177
public function searchDocuments($words, $includeAllDocs)
	{
		$this->checkBtreeIsLoaded();
		
		if ($this->_btree == null)
		{
			throw new NotFoundException("BTree is invalid. Try to recreate  the index.", 601);
		}
		else
		{
			$arr = BTreeUtil::searchDocuments(strtolower(trim($words)), $this->_btree, $includeAllDocs);

			return $arr;
		}
	}
102791
public function getFieldNames($includeMany = false)
    {
        $fieldNames = $this->getReadOnlyFields();
        foreach ($this->fields as $field => $value) {
            if ($includeMany || $this->getType($field) !== 'many') {
                $fieldNames[] = $field;
            }
        }
        return $fieldNames;
    }
368617
public function setAllowedCategories($categories)
    {
        if (is_string($categories)) {
            $categories = preg_split('/\s*,\s*/', $categories);
        }
        $this->allowedCategories = (array)$categories;
        return $this;
    }
956903
public function getChildren($includeHiddenFromNav = true)
    {
        if (is_null($this->children)) {
            $children = $this->menu->getChildren($this->node, true);
            /* @var NodeMenuItem $child */
            foreach ($children as $child) {
                $child->setParent($this);
            }
            $this->children = $children;
        }

        $children = array_filter($this->children, function (NodeMenuItem $entry) use ($includeHiddenFromNav) {
            if ($entry->getNode()->isHiddenFromNav() && !$includeHiddenFromNav) {
                return false;
            }

            return true;
        });

        return $children;
    }
1329085
protected function loadCategories(ContextInterface $context)
    {
        if (\array_key_exists($context->getId(), $this->categories)) {
            return;
        }

        $class = $this->getClass();

        $categories = $this->getObjectManager()->createQuery(sprintf('SELECT c FROM %s c WHERE c.context = :context ORDER BY c.parent ASC', $class))
            ->setParameter('context', $context->getId())
            ->execute();

        if (0 === \count($categories)) {
            // no category, create one for the provided context
            $category = $this->create();
            $category->setName($context->getName());
            $category->setEnabled(true);
            $category->setContext($context);
            $category->setDescription($context->getName());

            $this->save($category);

            $categories = [$category];
        }

        $rootCategories = [];
        foreach ($categories as $pos => $category) {
            if (null === $category->getParent()) {
                $rootCategories[] = $category;
            }

            $this->categories[$context->getId()][$category->getId()] = $category;

            $parent = $category->getParent();

            $category->disableChildrenLazyLoading();

            if ($parent) {
                $parent->addChild($category);
            }
        }

        $this->categories[$context->getId()] = $rootCategories;
    }
1302468
public static function getUnassignedBlockTypes($includeInternalBlockTypes = false)
    {
        $result = [];
        $app = Application::getFacadeApplication();
        $db = $app->make(Connection::class);
        $rs = $db->executeQuery(<<<EOT
select BlockTypes.btID
from BlockTypes
left join BlockTypeSetBlockTypes on BlockTypes.btID = BlockTypeSetBlockTypes.btID
left join BlockTypeSets on BlockTypeSetBlockTypes.btsID = BlockTypeSets.btsID
where BlockTypeSets.btsID is null
order by BlockTypes.btDisplayOrder asc
EOT
        );
        while (($btID = $rs->fetchColumn()) !== false) {
            $bt = BlockType::getByID($btID);
            if ($bt !== null) {
                if ($includeInternalBlockTypes || !$bt->isBlockTypeInternal()) {
                    $result[] = $bt;
                }
            }
        }

        return $result;
    }
113894
public function getAcceptedFileTypes($includeDot = false)
    {
        $types = $this->fileTypes;

        if ($types === false) {
            $isImage = starts_with($this->getDisplayMode(), 'image');
            $types = implode(',', FileDefinitions::get($isImage ? 'imageExtensions' : 'defaultExtensions'));
        }

        if (!$types || $types == '*') {
            return null;
        }

        if (!is_array($types)) {
            $types = explode(',', $types);
        }

        $types = array_map(function ($value) use ($includeDot) {
            $value = trim($value);

            if (substr($value, 0, 1) == '.') {
                $value = substr($value, 1);
            }

            if ($includeDot) {
                $value = '.'.$value;
            }

            return $value;
        }, $types);

        return implode(',', $types);
    }
710945
public function setCategories($categories)
    {
        foreach ($categories as $category) {
            $category->setBlog($this);
        }
        $this->categories = $categories;

        return $this;
    }
13544
public function toArray($includeMetaData = false, $nestedInclude = true, $callback = null)
	{
		$data = $this->transformToArray($this->data, $nestedInclude, [], $callback);
		
		if( ! $includeMetaData )
		{
			return $data;
		}

		$result = [];
		$result['data'] = $data;
		
		if( ! empty($this->included) && ! $nestedInclude && $includeMetaData)
		{
			$result['included'] = $this->transformToArray($this->getIncludes(), false, [], $callback);
		}

		if( $includeMetaData && ! empty($this->meta) )
		{
			$result['meta'] = $this->meta;
		}

		

		return $result;
	}