Beispiel #1
0
 /**
  * Get the path for the image used as the object's avatar
  *
  * @param  bool $url Whether to return an absolute URL
  * @return string  The path for the avatar
  */
 public function getAvatar($url = false)
 {
     if (empty($this->avatar) && $this->avatar !== null) {
         $this->resetAvatar();
     }
     if ($url) {
         return Service::getRequest()->getBaseUrl() . $this->avatar;
     }
     return $this->avatar;
 }
Beispiel #2
0
 /**
  * Modify the current page URL
  *
  * @param  array  $parameters An array of parameters to add/modify in the request
  * @return string The HTML link
  */
 public function __invoke(array $parameters)
 {
     $attributes = \Service::getRequest()->attributes;
     $query = \Service::getRequest()->query;
     return \Service::getGenerator()->generate($attributes->get('_route'), $parameters + $attributes->get('_route_params') + $query->all());
 }
Beispiel #3
0
 /**
  * Gets the browser's request
  * @return Symfony\Component\HttpFoundation\Request
  */
 public static function getRequest()
 {
     return Service::getRequest();
 }
Beispiel #4
0
 /**
  * Build the canonical URL of a relative URL
  *
  * @param  string $relativeUrl
  * @return string The canonical URL
  */
 public function __invoke($relativeUrl)
 {
     $baseURL = \Service::getRequest()->getSchemeAndHttpHost();
     return $baseURL . $relativeUrl;
 }