Get images.

@param string $tag

@return collection
7092
public function images($tag = null)
    {
        $images = [];

        if (is_array($tag)) {
            foreach ($tag as $tagName) {
                $images = array_merge($images, $this->imageRepo->getImagesByTag($tag)->get()->toArray());
            }
        } elseif (is_null($tag)) {
            $images = array_merge($images, $this->imageRepo->getImagesByTag()->get()->toArray());
        } else {
            $images = array_merge($images, $this->imageRepo->getImagesByTag($tag)->get()->toArray());
        }

        return $images;
    }
1346961
public static function get_tag_collections() {
        global $CFG, $PAGE;

        if (empty($CFG->usetags)) {
            throw new moodle_exception('tagsaredisabled', 'tag');
        }

        $context = context_system::instance();
        self::validate_context($context);
        $PAGE->set_context($context); // Needed by internal APIs.
        $output = $PAGE->get_renderer('core');

        $collections = core_tag_collection::get_collections();
        $exportedcollections = array();
        foreach ($collections as $collection) {
            $exporter = new \core_tag\external\tag_collection_exporter($collection);
            $exportedcollections[] = $exporter->export($output);
        }

        return array(
            'collections' => $exportedcollections,
            'warnings' => array(),
        );
    }
194576
public function getMappedTag($tag)
    {
        if (isset($this->mappedTags[$tag]) === true) {
            return $this->mappedTags[$tag];
        } else {
            throw new OutOfBoundsException('Annotation tag "' . $tag . '" was not mapped.');
        }
    }
89212
public function tag($tags)
    {
        return $this->proxy($this->parent, $this->storage, $this->storageName)
                    ->with($this->attributes(['tag' => $tags]));
    }
2450
public function getTaggedQuestions($tag)
    {
        $question = new Question($this->di->get("db"));

        $questions = $question->getQuestions();



        $filteredQuestions = array_filter($questions, function ($value) use ($tag) {
            return in_array($tag, $value->tags);
        });

        $views = [
            ["comment/question/view-all", ["questions" => $filteredQuestions,
             "headerTitle" => "Frågor med taggen $tag"], "main"]
        ];

        $this->di->get("pageRenderComment")->renderPage([
            "views" => $views,
            "title" => "Questions | $tag"
        ]);
    }
813488
public function findByTag($tag, $params = array(), $options = array())
    {
        $path = sprintf("/tags/%s/tasks", $tag);
        return $this->client->getCollection($path, $params, $options);
    }
656529
public static function existingTags(): Collection
    {
        return Tagged::query()
            ->distinct()
            ->join('tagging_tags', 'tag_slug', '=', 'tagging_tags.slug')
            ->where('taggable_type', '=', (new static)->getMorphClass())
            ->orderBy('tag_slug', 'ASC')
            ->get(array('tag_slug as slug', 'tag_name as name', 'tagging_tags.count as count'));
    }
87025
public function onReplace($tag)
    {
        $chunks = trimsplit('::', $tag);

        if ('news_categories' === $chunks[0]) {
            /** @var Input $input */
            $input = $this->framework->getAdapter(Input::class);

            if ($alias = $input->get($this->manager->getParameterName())) {
                /** @var NewsCategoryModel $model */
                $model = $this->framework->getAdapter(NewsCategoryModel::class);

                if (null !== ($category = $model->findPublishedByIdOrAlias($alias))) {
                    $value = $category->{$chunks[1]};

                    // Convert the binary to UUID for images (#147)
                    if ($chunks[1] === 'image' && $value) {
                        return StringUtil::binToUuid($value);
                    }

                    return $value;
                }
            }
        }

        return false;
    }
902319
public function tag(string $tag): array
    {
        return $this->hasTag($tag) ? $this->tags[$tag] : null;
    }
843214
protected function openStyle(string $tag): string
	{
		$this->openTags[] = $tagName = $this->getTagName($tag);

		return $this->getSgrStyleSequence($tagName);
	}
983648
public function show(string $tag, array $params = [])
    {
        $path = $this->buildTagsPath($tag);

        return $this->get($path, $params);
    }
31702
public function tags(Tags $tags = null)
    {
        if (is_null($tags)) {
            return $this->tags;
        }

        $this->tags = $tags;

        return $this;
    }
934521
private function parseImage(string $image, string $tag)
    {
        $image_array = explode(':', $image);

        $pull_tag = $tag;
        $pull_image = $image;

        /*
         * 1 khs1994/nginx
         * 2 khs1994/nginx:1.15.1-alpine
         * 2 docker.khs1994.com:1000/khs1994/nginx
         * 3 docker.khs1994.com:1000/khs1994/nginx:1.15.1-alpine
         */
        if (1 !== \count($image_array)) {
            // 取最后一位为 tag,删除 tag,得到 image
            $tag = array_pop($image_array);
            $image = implode('', $image_array);

            if (preg_match('#/#', $tag)) {
                $tag = $pull_tag;
                $image = $pull_image;
            }
        }

        return [$image, $tag];
    }
403839
public function get($tag)
    {
        // load if necessary
        if (!$this->loaded) {
            $this->load();
        }

        // get tag
        if (!isset($this->phrases[$tag]) || $this->phrases[$tag] == '') {
            return 'LOCALIZE [' . $this->local . ']: ' . $tag;
        } else {
            return $this->phrases[$tag];
        }
    }
522229
public function getTagValue($tag)
	{
		if(!$this->hasTag($tag))
		{
			throw new \OutOfBoundsException('Tag ' . $tag . ' is not set');
		}
		
		if(empty($this->tags[$tag]))
		{
			throw new \OutOfBoundsException('Tag ' . $tag . ' does not have a value');
		}
		
		return $this->tags[$tag][0];
	}
1281591
public function show($tag)
    {
        $images = $this->repository->getImagesByTag($tag)->paginate(Config::get('cms.pagination'));
        $tags = $this->repository->allTags();

        if (empty($images)) {
            abort(404);
        }

        return view('cms-frontend::gallery.show')
            ->with('tags', $tags)
            ->with('images', $images)
            ->with('title', $tag);
    }
1224338
private function getServiceListByTag($tag)
    {
        $services = [];
        $serviceIds = [];
        $serviceDefinitions = $this->container->getDefinitions();

        foreach ($tag as $tagId) {
            $serviceIds = array_merge(
                $serviceIds,
                array_keys($this->container->findTaggedServiceIds($tagId))
            );
        }

        foreach ($serviceIds as $serviceId) {
            $serviceDefinition = $serviceDefinitions[$serviceId];
            if ($serviceDefinition) {
                $services[] = [$serviceId, $serviceDefinition->getClass()];
            }
        }

        usort($services, [$this, 'compareService']);
        return $services;
    }