Listed all options

This commit is contained in:
Kevin Frantz
2018-07-14 19:26:55 +02:00
parent 5c5eb64fd8
commit f938f70e78
3 changed files with 60 additions and 4 deletions

52
src/router/Link.php Normal file
View File

@@ -0,0 +1,52 @@
<?php
namespace router;
/**
*
* @author kevinfrantz
*
*/
class Link
{
/**
* ArrayCollection would be nicer but I have to save time ;)
* @var array
*/
private $parameters;
/**
*
* @var string
*/
private $name;
public function __construct(array $parameters=[],string $name = ''){
$this->setParameters($parameters);
$this->setName($name);
}
public function setParameters(array $parameters):void{
$this->parameters = $parameters;
}
public function setName(string $name):void{
$this->name = $name;
}
public function getName():string{
return $this->name;
}
public function getUrl():string{
return "index.php".$this->getParameters();
}
private function getParameters():string{
$parameters = '?';
foreach ($this->parameters as $key=>$value){
$parameters .= $key.'='.$value.'&';
}
return $parameters;
}
}