Parses through link annotations and generates valid links
@param LinkCollection $annot
@param                $view
@param \stdClass      $output
@param                $object
@return \stdClass
322289
protected function parseLinks(LinkCollection $annot, $view, \stdClass $output, $object)
    {
        $generator = $this->linkGenerator;
        array_walk(
            $annot->links,
            function($link) use ($view, $output, $generator, $object) {
                if ($view == null || in_array($view, $link->views)) {
                    $name = $generator->parseName($link, $object);
                    $output->$name = $generator->generate($link, $object);
                }
            }
        );

        return $output;
    }
113956
public function links($view = null)
    {
        if ($this->limit) {
            if ($this->hash != '')
                $links =  $this->paginator->appends($this->url->remove('page'.$this->cid)->getArray())->fragment($this->hash)->render($view);
            else
                $links =  $this->paginator->appends($this->url->remove('page'.$this->cid)->getArray())->render($view);

            $links = str_replace('#pjax','%23pajax',$links);
            return str_replace('/?', '?', $links);
        }
    }
728750
@Override
	public ControllerLinkBuilder linkTo(Class<?> controller, Object... parameters) {
		return ControllerLinkBuilder.linkTo(controller, parameters);
	}
838687
public function generateObjectUrl($name, $object, array $parameters = array(), $absolute = false)
    {
        if ($name != 'list') {
            return parent::generateObjectUrl($name, $object, $parameters, $absolute);
        }

        return parent::generateObjectUrl($name, $object->getForm(), $parameters, $absolute);
    }
392106
public function generatePermalink($object = null)
    {
        $manager = $this->getContainer()->get('compo_articles.manager.articles');

        if ($object) {
            return $manager->getArticleShowPermalink($object);
        }

        return $manager->getArticlesIndexPermalink();
    }
668517
public function href(string $rel, AbstractRequest $request, array $query)
    {
        $classMethod = 'on' . ucfirst($request->method);
        $annotations = $this->reader->getMethodAnnotations(new \ReflectionMethod(get_class($request->resourceObject), $classMethod));
        foreach ($annotations as $annotation) {
            if ($this->isValidLinkAnnotation($annotation, $rel)) {
                return $this->getMethodUdi($request, $query, $annotation);
            }
        }

        throw new LinkException("rel:{$rel} class:" . get_class($request->resourceObject), 500);
    }
269312
public function generatePermalink($object = null)
    {
        $manager = $this->getContainer()->get('compo_news.manager.news');

        if (null === $object) {
            return $manager->getNewsIndexPermalink();
        }

        return $manager->getNewsShowPermalink($object);
    }
1357038
private function annotationLink(LinkType $link, ResourceObject $current, AbstractRequest $request)
    {
        if (! is_array($current->body)) {
            throw new Exception\LinkQueryException('Only array is allowed for link in ' . get_class($current), 500);
        }
        $classMethod = 'on' . ucfirst($request->method);
        $annotations = $this->reader->getMethodAnnotations(new \ReflectionMethod(get_class($current), $classMethod));
        if ($link->type === LinkType::CRAWL_LINK) {
            return $this->annotationCrawl($annotations, $link, $current);
        }

        /* @noinspection ExceptionsAnnotatingAndHandlingInspection */
        return $this->annotationRel($annotations, $link, $current)->body;
    }
1374479
public static function view($url, $view, $data = null)
    {
        $callback = function () use ($view, $data) {
            $view = view($view);

            if (!is_null($data)) {
                foreach ($data as $key => $value) {
                    $view = $view->with($key, $value);
                }
            }

            return $view;
        };

        static::get($url, $callback);
    }
740275
static function link_object_to($from, $to, $params = [])
	{
		$data = [
			'from_class'=> $from->extends_class_id(),
			'from_id'	=> $from->id(),
			'to_class'	=> $to->extends_class_id(),
			'to_id'		=> $to->id(),
		];

		$link = bors_find_first('bors_link', $data);
		if($link)
		{
			$link->set_sort_order(defval($params, 'sort_order', 0));
			foreach($params as $k => $v)
				$link->set($k, $v, true);

			$link->set_target($to);
			$link->store();

			return false;
		}

		if(empty($params['owner_id']))
			$params['owner_id'] = bors()->user_id();

		$data['sort_order'] = defval($params, 'sort_order', 0);
		foreach($params as $k => $v)
			$data[$k] = $v;

		self::set_target_array($data, $to);

		$link = bors_new('bors_link', $data);

		if(method_exists($to, 'set_parent_object') && !$to->parent_object())
			$to->set_parent_object($from);

		echo "\nnew link {$from} => {$to}\n";

		$link->store();

		return true;
	}
971891
protected function parse($object)
    {
        if (! is_object($object)) {
            throw new ValidationException(
                'DocumentLink has to be an object, "' . gettype($object) . '" given.'
            );
        }

        $links = get_object_vars($object);

        if (array_key_exists('self', $links)) {
            if (! is_string($links['self']) and ! is_object($links['self'])) {
                throw new ValidationException(
                    'property "self" has to be a string or object, "' .
                    gettype($links['self']) . '" given.'
                );
            }

            $this->setLink('self', $links['self']);

            unset($links['self']);
        }

        if (array_key_exists('related', $links)) {
            if (! is_string($links['related']) and ! is_object($links['related'])) {
                throw new ValidationException(
                    'property "related" has to be a string or object, "' .
                    gettype($links['related']) . '" given.'
                );
            }

            $this->setLink('related', $links['related']);

            unset($links['related']);
        }

        // Pagination links, if data in parent attributes exists
        if ($this->getParent()->has('data')) {
            if (array_key_exists('first', $links)) {
                $this->setPaginationLink('first', $links['first']);

                unset($links['first']);
            }

            if (array_key_exists('last', $links)) {
                $this->setPaginationLink('last', $links['last']);

                unset($links['last']);
            }

            if (array_key_exists('prev', $links)) {
                $this->setPaginationLink('prev', $links['prev']);

                unset($links['prev']);
            }

            if (array_key_exists('next', $links)) {
                $this->setPaginationLink('next', $links['next']);

                unset($links['next']);
            }
        }

        // custom links
        foreach ($links as $name => $value) {
            $this->setLink($name, $value);
        }
    }
867316
public function addLinkObject($key, LinkObject $linkObject) {
		$this->ensureLinksObject();
		$this->links->addLinkObject($key, $linkObject);
	}
159534
protected function handleLinks(RelationshipAnnotation $annotation, Relationship $relationship)
    {
        foreach ($annotation->links as $linkAnnotation)
        {
            $link = $this->createLink($linkAnnotation);

            $relationship->addLink($link);
        }
    }
57132
protected function createLink(LinkAnnotation $annotation): Link
    {
        if (! preg_match(self::RESOURCE_PATTERN, $annotation->resource, $matches)) {
            throw new \LogicException(sprintf('Invalid resource definition: "%s"', $annotation->resource));
        }

        $link = new Link(
            $annotation->name,
            $matches['repository'],
            $matches['link']
        );

        $link->setParameters($annotation->parameters);
        $link->setMetadata($annotation->metadata);

        return $link;
    }
872849
public function generateView($group, $module, $model, $mode, $output, $file = "", $customTemplate = "")
    {
        if($output != "api")
        {
            $generator = new ViewGenerator($group, $module, $model, $mode, $output, $file, $customTemplate);
            $generator->run();
        }
    }
243098
public function format($object, $path, $view = 'default')
    {
        $type = $this->typeProvider->xType($object, $path);
        $value = $this->extractor->value($object, $path);
        return $this->value($type, $value, $view);
    }
1234764
@Override
	public ControllerLinkBuilder linkTo(Method method, Object... parameters) {
		return ControllerLinkBuilder.linkTo(method, parameters);
	}