From f27cca08ff786ceff1870147f6d6bad14d71117f Mon Sep 17 00:00:00 2001 From: polo Date: Fri, 23 Oct 2026 00:47:32 +0200 Subject: =?UTF-8?q?dossiers=20avec=20majuscule,=20namespace=20pour=20toute?= =?UTF-8?q?s=20les=20classes,=20autoload=20psr-4,=20UserDataService::creat?= =?UTF-8?q?eZip=20d=C3=A9plac=C3=A9=20dans=20Backup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/service/URL.php | 88 ----------------------------------------------------- 1 file changed, 88 deletions(-) delete mode 100644 src/service/URL.php (limited to 'src/service/URL.php') diff --git a/src/service/URL.php b/src/service/URL.php deleted file mode 100644 index 5bd2594..0000000 --- a/src/service/URL.php +++ /dev/null @@ -1,88 +0,0 @@ -params = $gets; - if($anchor != ''){ - $this->setAnchor($anchor); - } - } - - // setters statiques - static public function setProtocol(string $protocol = 'http'): void - { - self::$protocol = $protocol === 'https' ? 'https://' : 'http://'; - } - static public function setPort(int|string $port = 80): void - { - if((int)$port === 443){ - self::$protocol = 'https://'; - self::$port = ''; - } - elseif((int)$port === 80){ - self::$protocol = 'http://'; - self::$port = ''; - } - else{ - self::$port = ':' . (string)$port; - } - } - static public function setHost(string $host): void - { - self::$host = $host; - } - static public function setPath(string $path): void - { - self::$path = '/' . ltrim($path, '/'); - } - - //setters normaux - public function addParams(array $gets): void - { - // array_merge est préféré à l'opérateur d'union +, si une clé existe déjà la valeur est écrasée - $this->params = array_merge($this->params, $gets); - } - public function setAnchor(string $anchor = ''): void - { - if($anchor != ''){ - $this->anchor = '#' . ltrim($anchor, '#'); - } - else{ - $this->anchor = ''; - } - } - - private function makeParams(): string - { - $output = ''; - $first = true; - - foreach($this->params as $key => $value) { - if($first){ - $output .= '?'; - $first = false; - } - else{ - $output .= '&'; - } - $output .= $key . '=' . $value; - } - return $output; - } - - public function __toString(): string - { - return self::$protocol . self::$host . self::$port . self::$path . $this->makeParams() . $this->anchor; - } -} \ No newline at end of file -- cgit v1.2.3